diff options
| -rw-r--r-- | challenge-099/luca-ferrari/raku/ch-1.p6 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-099/luca-ferrari/raku/ch-1.p6 b/challenge-099/luca-ferrari/raku/ch-1.p6 new file mode 100644 index 0000000000..00fa7c8c0e --- /dev/null +++ b/challenge-099/luca-ferrari/raku/ch-1.p6 @@ -0,0 +1,12 @@ +#!raku + +sub MAIN( Str $S, Str $P ) { + say "String [$S] with pattern [$P]"; + + # substitute every ? to match a single char + # and every * to match a stream of chars + # and add anchors + my $regexp = '^' ~ $P.subst( '*', '.*' ).subst( '?', '.' ) ~ '$'; + { say 1; exit; } if $S ~~ / <$regexp> /; + say 0; +} |
