in reply to Global regexp
The Perl regular expression engine starts the next match always after the last matched character of the previous match. So you will need lookahead assertions (?= that don't adjust pos if you don't want to fiddle with pos yourself (see perlre on lookahead assertions):
perl -le "$_='1234';@x=/(?=(\d\d))/g;print for @x"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global regexp
by throop (Chaplain) on Jun 16, 2008 at 12:32 UTC | |
by Corion (Patriarch) on Jun 16, 2008 at 12:49 UTC | |
by ikegami (Patriarch) on Jun 16, 2008 at 15:52 UTC | |
by throop (Chaplain) on Jun 16, 2008 at 22:36 UTC | |
|
Re^2: Global regexp
by Anonymous Monk on Jun 16, 2008 at 09:09 UTC | |
by Anonymous Monk on Jun 16, 2008 at 10:02 UTC |