in reply to •Re: positions of all regexp matches
in thread positions of all regexp matches
use re 'eval'; my $string = "hello world ballloon"; my $regex = qr/ll/; my @matches; () = $string =~ /(?=$regex)(?{push @matches, pos})./g; print join "\n", @matches; __END__ 2 14 15
--
flounder
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: •Re: positions of all regexp matches
by merlyn (Sage) on Oct 14, 2003 at 19:06 UTC | |
by flounder99 (Friar) on Oct 14, 2003 at 19:57 UTC | |
by merlyn (Sage) on Oct 14, 2003 at 20:04 UTC | |
by sandfly (Beadle) on Oct 14, 2003 at 22:40 UTC |