From 11146a92205a60d4c4e1ce36741f4ac11c66853d Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 Feb 2021 10:05:58 +0100 Subject: Task 1 done. --- challenge-099/luca-ferrari/raku/ch-1.p6 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 challenge-099/luca-ferrari/raku/ch-1.p6 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; +} -- cgit