in reply to Bug with finding all regexp matches

perl -e '"01234" =~ /^(.+)(.+)((?:.z?)+)$(?{ print "$1 $2 $3\n" })(*FAIL)/'
... program outputs only five variants and "0 1 234" disappears.

I see the same behavior on Strawberries 5.10.1.5, 5.12.3.0, 5.14.4.1 and ActiveState 5.8.9. (Have to use  (?!) in place of  (*FAIL) previous to 5.10, but these patterns are exactly equivalent.)

Why is this behavior seen? Dunno. Will have to think about this a bit.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Bug with finding all regexp matches
by Anonymous Monk on Oct 15, 2016 at 17:32 UTC
    Also changing the first capture to non-greedy should not affect the number of results (regexp is anchored on both sides), yet it does (for z? case, things work OK without it):
    perl -e '"01234" =~ /^(.+?)(.+)((?:.z?)+)$(?{ print "$1 $2 $3\n" })(*F +AIL)/' 0 123 4 0 12 34 0 1 234 01 23 4
    It looks like a bug. It smells like a bug. It ate my whole project. But... Is it a bug?