![]() |
|
more useful options | |
PerlMonks |
Re^7: Explain a regexp matched group resultby ig (Vicar) |
on Oct 28, 2013 at 20:52 UTC ( #1060062=note: print w/replies, xml ) | Need Help?? |
The note is interesting: they are highlighting this difference between ECMA script REs and Perl REs. The RE (x+)? is very similar to (x*), except that the latter will always match (and, therefore, never have the value from a previous match if it is in an enclosing repeating group. This is similar to the requirement in Note 3: "Step 4 of the RepeatMatcher clears Atom's captures each time Atom is repeated." Because it always matches it always has a value from the last repeat of the outer repeating group, as if it was reset for each repeat, except that the value is '' instead of undef in the case that x did not match. This is an easy transformation. I appreciate that you don't want to change the RE but you say you are parsing it, so perhaps you can make some systematic transformations. Consider:
Produces
In Section
Seekers of Perl Wisdom
|
|