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!
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!
In reply to Re^8: about style: use possessive or atomic? (BUG!!!)
by LanX
in thread about style: use possessive or atomic?
by rsFalse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |