http://qs321.pair.com?node_id=692556


in reply to Re^2: Global regexp
in thread Global regexp

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