in reply to Re^2: Regex code block executes twice per match using look-arounds
in thread Regex code block executes twice per match using look-arounds

Yes, well, the zero-width of the look behind and look ahead is clearly causing it to do something other than the obvious. I suspect the NFA (thanks sgt, interesting) is looking for something after the zero width thingies... Perhaps it would behave less oddly if you put a '.' before your code? Who really knows what the *FA is really doing?

Any way you look at it, your regex is unusual since all of the expressions are zero-width, so they kinda match? And the when of code embedded in the regex isn't all that well defined I bet since the perlre page calls it experimental...

I don't think it's changed in the last 5 years. I wonder when it'll stop being experimental.

-Paul

  • Comment on Re^3: Regex code block executes twice per match using look-arounds