in reply to Re: look-ahead greed changed between perl releases?
in thread look-ahead greed changed between perl releases?

So that overrides the greediness precept? The perlre document isn't clear on this, so I wasn't sure which behavior was considered correct.

I no longer have a 5.12.4 handy either: I discovered this issue after upgrading perl and finding my code was no longer working as it had before. Was this a bug in a 5.12.4? I can't find anything in the perl*delta docs that lead me to believe this is an intentional behavior change.

  • Comment on Re^2: look-ahead greed changed between perl releases?

Replies are listed 'Best First'.
Re^3: look-ahead greed changed between perl releases?
by sn1987a (Deacon) on May 06, 2014 at 18:29 UTC

    No, it does not override the greediness. The regexp still matches that longest string. But this is just a look ahead. Once the match/substitution is made, the regexp engine starts searching again after the first character matched.

    amon below has a great graphical view of what is happening (Re: look-ahead greed changed between perl releases?).