See Regexp::Exhaustive to get every possible match of a pattern against a string. It supports the use of $& et al (without global penalty).
use Regexp::Exhaustive 'exhaustive'; my @matches = exhaustive( 'asdf' => qr/..??/, qw[ $` $& $' ], ); printf "%s<%s>%s\n", @$_ for @matches; __END__ <a>sdf <as>df a<s>df a<sd>f as<d>f as<df> asd<f>
lodin
In reply to Re^3: Global regexp (Regexp::Exhaustive)
by lodin
in thread Global regexp
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |