RosettaCodeData/Task/String-matching/Perl-6/string-matching-4.pl6

3 lines
196 B
Raku
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
$haystack.match($needle, :g)».from; # List of all positions where $needle appears in $haystack
2020-02-17 23:21:07 -08:00
$haystack.indices($needle :overlap); # Also find any overlapping instances of $needle in $haystack