It shouldn't be hard to adapt if you want the offsets (as your original code does). It does capture overlapping matches, although with the given patterns, no overlap is possible.foreach my $pattern (@patterns) { for (my $i = 0; $i < length($string); $i += 3) { push @matches, ${^MATCH} if substr($string, $i) =~ /^$pattern/p; } }
In reply to Re: Perl Regex Repeating Patterns
by JavaFan
in thread Perl Regex Repeating Patterns
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |