in reply to Arbitrary number of captures in a regular expression
Indeed, the notion that repeating groups shouldn't throw away all but the final capture is fundamental to making Perl 6 regexes powerful enough to parse Perl 6. In a similar vein, the ordinary scalar comma operator does not throw away its left argument anymore in Perl 6 either. Perl 6 has pretty much cleaned out all the dirty little spots where Perl 5 has "return the last one" semantics.$str ~~ mm/foo [ m (\d+) ]* bar/; my @matches = @$0;
Update: I also forgot the 'bar'...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Arbitrary number of captures in a regular expression
by demerphq (Chancellor) on Sep 25, 2007 at 23:24 UTC | |
by TimToady (Parson) on Sep 26, 2007 at 00:27 UTC | |
|
Re^2: Arbitrary number of captures in a regular expression
by mwah (Hermit) on Sep 25, 2007 at 17:24 UTC | |
by TimToady (Parson) on Sep 25, 2007 at 18:33 UTC | |
by ikegami (Patriarch) on Sep 25, 2007 at 19:50 UTC | |
by mwah (Hermit) on Sep 25, 2007 at 20:15 UTC |