in reply to Re^7: about style: use possessive or atomic? (bug)
in thread about style: use possessive or atomic?

so I installed 5.20.2 via perlbrew and it's even getting scarier, the behaviour of {n}+ has changed.

DB<3> print "aaa" =~ /(a+){1}+a/ aa DB<4> print "aaa" =~ /(a+){1}a/ aa DB<5> print $] 5.020002

while with 5.14 it's still like documented:

DB<1> print "aaa" =~ /(a+){1}+a/ DB<2> print "aaa" =~ /(a+){1}a/ aa DB<3> print $] 5.014002

This is worse than an erroneous warning that's a fatal break of backwards compatibility!

update

5.20 is backtracking while told otherwise

lanx@lanx-1005HA:~$ perl -Mre=debug -e' print "aaa" =~ /(a+){1}+a/ ' Compiling REx "(a+){1}+a" Final program: 1: CURLYX[0] {1,1} (11) 3: OPEN1 (5) 5: PLUS (8) 6: EXACT <a> (0) 8: CLOSE1 (10) 10: WHILEM (0) 11: NOTHING (12) 12: EXACT <a> (14) 14: END (0) anchored "a" at 0 floating "aa" at 0..2147483647 (checking floating) p +lus minlen 2 Matching REx "(a+){1}+a" against "aaa" Intuit: trying to determine minimum start position... Found floating substr "aa" at offset 0... Found anchored substr "a" at offset 0... (multiline anchor test skipped) Intuit: Successfully guessed: match at offset 0 0 <> <aaa> | 1:CURLYX[0] {1,1}(11) 0 <> <aaa> | 10: WHILEM(0) whilem: matched 0 out of 1..1 0 <> <aaa> | 3: OPEN1(5) 0 <> <aaa> | 5: PLUS(8) EXACT <a> can match 3 times out +of 2147483647... 3 <aaa> <> | 8: CLOSE1(10) 3 <aaa> <> | 10: WHILEM(0) whilem: matched 1 out of 1..1 3 <aaa> <> | 11: NOTHING(12) 3 <aaa> <> | 12: EXACT <a>(14) failed... failed... 2 <aa> <a> | 8: CLOSE1(10) 2 <aa> <a> | 10: WHILEM(0) whilem: matched 1 out of 1..1 2 <aa> <a> | 11: NOTHING(12) 2 <aa> <a> | 12: EXACT <a>(14) 3 <aaa> <> | 14: END(0) Match successful! aaFreeing REx: "(a+){1}+a"

And that's the trace from 5.14

lanx@lanx-1005HA:~$ perl -Mre=debug -e' print "aaa" =~ /(a+){1}+a/ ' Compiling REx "(a+){1}+a" Final program: 1: SUSPEND (16) 3: CURLYX[0] {1,1} (13) 5: OPEN1 (7) 7: PLUS (10) 8: EXACT <a> (0) 10: CLOSE1 (12) 12: WHILEM (0) 13: NOTHING (14) 14: SUCCEED (0) 15: TAIL (16) 16: EXACT <a> (18) 18: END (0) anchored "a" at 0 floating "aa" at 0..2147483647 (checking floating) m +inlen 2 Guessing start of match in sv for REx "(a+){1}+a" against "aaa" Found floating substr "aa" at offset 0... Found anchored substr "a" at offset 0... Guessed: match at offset 0 Matching REx "(a+){1}+a" against "aaa" 0 <> <aaa> | 1:SUSPEND(16) 0 <> <aaa> | 3: CURLYX[0] {1,1}(13) 0 <> <aaa> | 12: WHILEM(0) whilem: matched 0 out of 1..1 0 <> <aaa> | 5: OPEN1(7) 0 <> <aaa> | 7: PLUS(10) EXACT <a> can match 3 times ou +t of 2147483647... 3 <aaa> <> | 10: CLOSE1(12) 3 <aaa> <> | 12: WHILEM(0) whilem: matched 1 out of 1.. +1 3 <aaa> <> | 13: NOTHING(14) 3 <aaa> <> | 14: SUCCEED(0) subpattern success... 3 <aaa> <> | 16:EXACT <a>(18) failed... 1 <a> <aa> | 1:SUSPEND(16) 1 <a> <aa> | 3: CURLYX[0] {1,1}(13) 1 <a> <aa> | 12: WHILEM(0) whilem: matched 0 out of 1..1 1 <a> <aa> | 5: OPEN1(7) 1 <a> <aa> | 7: PLUS(10) EXACT <a> can match 2 times ou +t of 2147483647... 3 <aaa> <> | 10: CLOSE1(12) 3 <aaa> <> | 12: WHILEM(0) whilem: matched 1 out of 1.. +1 3 <aaa> <> | 13: NOTHING(14) 3 <aaa> <> | 14: SUCCEED(0) subpattern success... 3 <aaa> <> | 16:EXACT <a>(18) failed... 2 <aa> <a> | 1:SUSPEND(16) 2 <aa> <a> | 3: CURLYX[0] {1,1}(13) 2 <aa> <a> | 12: WHILEM(0) whilem: matched 0 out of 1..1 2 <aa> <a> | 5: OPEN1(7) 2 <aa> <a> | 7: PLUS(10) EXACT <a> can match 1 times ou +t of 2147483647... 3 <aaa> <> | 10: CLOSE1(12) 3 <aaa> <> | 12: WHILEM(0) whilem: matched 1 out of 1.. +1 3 <aaa> <> | 13: NOTHING(14) 3 <aaa> <> | 14: SUCCEED(0) subpattern success... 3 <aaa> <> | 16:EXACT <a>(18) failed... Match failed Freeing REx: "(a+){1}+a"

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^9: about style: use possessive or atomic? (BUG!!!)
by rsFalse (Chaplain) on Aug 16, 2015 at 23:28 UTC
    So I think that you can post it to perlbug with a link to this node?
        FYI: got an email saying it's fixed now

        According to our records, your request regarding "{n}+ possessive quantifier broken in 5.20" has been resolved.

        If you have any further questions or concerns, please respond to this message.

        For other topics, please create a new ticket.

        <URL: https://rt.perl.org/Ticket/Display.html?id=125825 >

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!