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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Global regexp (Regexp::Exhaustive)
by Anonymous Monk on Jun 18, 2008 at 04:42 UTC |
In Section
Seekers of Perl Wisdom