RosettaCodeData/Task/String-matching/Perl-6/string-matching-4.pl6
2020-02-17 23:21:07 -08:00

2 lines
196 B
Raku

$haystack.match($needle, :g)».from; # List of all positions where $needle appears in $haystack
$haystack.indices($needle :overlap); # Also find any overlapping instances of $needle in $haystack