http://qs1969.pair.com?node_id=762839


in reply to Re: Using Look-ahead and Look-behind
in thread Using Look-ahead and Look-behind

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.