Just another Perl shrine | |
PerlMonks |
Re: Trying to count the captures in a compiled regular expressionby hv (Prior) |
on May 03, 2004 at 02:11 UTC ( [id://349900]=note: print w/replies, xml ) | Need Help?? |
With respect to (?xism-xism:...), beware of the docs for this (my emphasis): One or more embedded pattern-match modifiers, to be turned on (or turned off, if preceded by "-") for the remainder of the pattern or the remainder of the enclosing pattern group (if any).If I understand that correctly, the "only look at openings" approach will fail on something like: or
The simplistic (?{...}) parsing I referred to is in toke.c:scan_const(); look for the test which simply counts unescaped braces until the opening one is closed - something like: would be fitting, though I suspect there must be a simpler way. (consider how lucky I am that the regular expression engine is not reentrant...) Now now, no need for that sort of language. Hugo
In Section
Seekers of Perl Wisdom
|
|