in reply to •Re: Re: •Re: positions of all regexp matches
in thread positions of all regexp matches
use re 'eval'; my $string = "he\nllo world ba\nllloon"; my $regex = qr/\nll/; my @matches; () = $string =~ /(?=$regex)(?{push @matches, pos})./sg; print "with .\n", join "\n", @matches; @matches = (); () = $string =~ /(?=$regex)(?{push @matches, pos})/sg; print "\n\nwithout .\n", join "\n", @matches; __END__ with . 2 15 without . 2 2 15 15
--
flounder
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re:^4 positions of all regexp matches
by merlyn (Sage) on Oct 14, 2003 at 20:04 UTC | |
by sandfly (Beadle) on Oct 14, 2003 at 22:40 UTC |