in reply to Re: Arbitrary number of captures in a regular expression
in thread Arbitrary number of captures in a regular expression
my @foobar = ( 'foo m 1 m 2 m 3 m 4 bar', 'foo m 2 m 4 m 7 bar', 'foo m 1 bar' ); my ($cnt, @match) = (0, ()) ; /^foo (?:m (\d+)(?{push @{$match[$cnt]}, $^N}) )+bar(?{++$cnt})/ for + @foobar; print map "@$_\n", @match;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Arbitrary number of captures in a regular expression
by TimToady (Parson) on Sep 25, 2007 at 18:33 UTC | |
|
Re^3: Arbitrary number of captures in a regular expression
by ikegami (Patriarch) on Sep 25, 2007 at 19:50 UTC | |
by mwah (Hermit) on Sep 25, 2007 at 20:15 UTC |