Perl: the Markov chain saw | |
PerlMonks |
Re: Arbitrary number of captures in a regular expressionby Sidhekin (Priest) |
on Sep 23, 2007 at 20:59 UTC ( [id://640613]=note: print w/replies, xml ) | Need Help?? |
... and if you still want a one-step approach ... This must be a job for the /g modifier and its side-kick, \G:
(The negative lookbehind in order to prevent matching strings starting with the m \d+ pattern — the positive lookahead to prevent matching strings that don't properly close with bar.) With a little test case, it looks like this:
... and outputs like this:
Update: Almost missed the "bar" requirement. Fixed now, right?
print "Just another Perl ${\(trickster and hacker)},"
In Section
Seekers of Perl Wisdom
|
|