in reply to multiple matches with regexp
This uses (?{}) (just a bit of code within a RegEx that is executed whenever the RE engine runs over it) and (?!) (negative look-ahead), so that it always fails (that's a bit of its magic), both explained in perlre. You could say it is ugly, but I personally like it :-).$a="aaaa"; $a=~m/(aa)(?{push @a, $1})(?!)/; print join ( "-", @a );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: multiple matches with regexp
by sandfly (Beadle) on Oct 10, 2003 at 21:08 UTC | |
by CombatSquirrel (Hermit) on Oct 10, 2003 at 22:04 UTC | |
by almaric (Acolyte) on Oct 11, 2003 at 17:25 UTC | |
|
Re: Re: multiple matches with regexp
by almaric (Acolyte) on Oct 11, 2003 at 00:46 UTC |