in reply to Bug with finding all regexp matches

Is it a bug?

If you enable re 'debug', then you'll get to see what's going on in detail. The compiled regexes differ in much the way you'd expect:

Final program: Final program: 1: BOL (2) 1: BOL (2) 2: OPEN1 (4) 2: OPEN1 (4) 4: PLUS (6) 4: PLUS (6) 5: REG_ANY (0) 5: REG_ANY (0) 6: CLOSE1 (8) 6: CLOSE1 (8) 8: OPEN2 (10) 8: OPEN2 (10) 10: PLUS (12) 10: PLUS (12) 11: REG_ANY (0) 11: REG_ANY (0) 12: CLOSE2 (14) 12: CLOSE2 (14) 14: OPEN3 (16) 14: OPEN3 (16) 16: PLUS (18) 16: CURLYX[2] {1,3276 +7} (24) 17: REG_ANY (0) 18: REG_ANY (19) 19: CURLY {0,1} (23 +) 21: EXACT <z> (0) 23: WHILEM[1/1] (0) 24: NOTHING (25) 18: CLOSE3 (20) 25: CLOSE3 (27) 20: EOL (21) 27: EOL (28) 21: EVAL (23) 28: EVAL (30) 23: OPFAIL (24) 30: OPFAIL (31) 24: END (0) 31: END (0)

Comparing the traces is harder.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Bug with finding all regexp matches
by Anonymous Monk on Oct 15, 2016 at 18:12 UTC
    For
    perl -e 'use re "debug"; "01234" =~ /^(.+)(.+)((?:.z?)+)$(?{ print "$1 + $2 $3\n" })(*FAIL)/' 2>&1 | less
    for the missing "0 1 234" the trace has
    whilem: (cache) already tried at this position... failed...
    and my wild guess is that it cached the effect of (*FAIL) and not the real failure of a regexp, hence EVAL is skipped and last result is missed. I didn't find the way to disable the cache with "use re".
      To add to the previous post: For
      perl -e 'use re "debug"; "01234" =~ /^(.+?)(.+)((?:.z?)+)$(?{ print "$ +1 $2 $3\n" })(*FAIL)/' 2>&1 | less
      two results are missing and there are two entries
      whilem: (cache) already tried at this position... failed...
      It figures.
        I opened a bug on this, https://rt.perl.org/Ticket/Display.html?id=129886 .