in reply to Re^3: Leaking Regex Captures
in thread Leaking Regex Captures

The overall regex matches. But the branch doing the capturing fails when the 'g' is in that position. The capture branch is only successful the first time, when it matches 'eb' and should capture the 'e'. Then the next times around it fails, but still captures.

The inconsistent capturing when backtracking in alternations inside repetitions are involved. That is what does not make sense, and what I am trying to understand.

Replies are listed 'Best First'.
Re^5: Leaking Regex Captures
by jwkrahn (Abbot) on Aug 05, 2009 at 14:50 UTC

    It fails but that does not mean it still captures.   In fact it can't have captured because that branch was not taken.   What it means is that the $1 variable has invalid data in it.