No such thing as a small change | |
PerlMonks |
Re^3: regex for stringby arkturuz (Curate) |
on Aug 18, 2009 at 09:36 UTC ( [id://789402]=note: print w/replies, xml ) | Need Help?? |
It won't match what you want because the '*' quantifier is greedy, and the '?' can match 0 or 1 times. So, the '*' matches all of the it can, and the last '?' matches 0 times; so the match is successful. You have to force '*' to give something back to the rest of the regex by replacing '?' with '{1}' for example.
In Section
Seekers of Perl Wisdom
|
|