|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Regex bug in 5.10 (was: Using Look-ahead and Look-behind)by Roy Johnson (Monsignor) |
| on May 08, 2009 at 14:39 UTC ( #762839=note: print w/ replies, xml ) | Need Help?? |
|
I think you have found a bug in 5.10's regex handling. The lookahead's greediness or non-greediness should not matter, because it does not consume any characters. When used in a global match, patterns that do not consume characters should advance one character on each match. At least that's how I read the documentation. The really interesting thing about your version is that you didn't make the capture non-greedy, you made it optional. You probably meant (.*?), which (in pre-5.10) will output empty strings every time. I haven't installed 5.10 myself, so I can't play with it right now. Caution: Contents may have been coded under pressure.
In Section
Tutorials
|
|
||||||||||||||||||||||||