Welcome to the Monastery | |
PerlMonks |
Re^5: On zero-width negative lookahead assertionsby ysth (Canon) |
on Sep 10, 2004 at 17:39 UTC ( [id://390141]=note: print w/replies, xml ) | Need Help?? |
To make it behave as you describe, use (?>\s*). The (?> ) says whatever is in it will match whatever it would match at that point in the string as an independent expression. So if matching all the spaces makes something later on fail, it won't backtrack and try having the \s* match fewer spaces.
(It's really time to unmark all of the extensions as experimental, except perhaps how variables in (?{}) and (??{}) bind.)
In Section
Seekers of Perl Wisdom
|
|