The test in question is this:
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){6,7}?(.)/ && $0), "e", 're_tests 617/1
(801)');
It turns out that the problem is not related to P5, but happens with P6Regex as
well:
<bartolin> r: say ("ddd" ~~ / [ x | d ] **? 3 /)
<camelia> rakudo-jvm fb4f16: OUTPUT«「d」»
<camelia> ..rakudo-moar 637241: OUTPUT«「ddd」»
<bartolin> r: say ("ddd" ~~ / [ x | d ] **? 2..3 /)
<camelia> rakudo-jvm fb4f16: OUTPUT«「d」»
<camelia> ..rakudo-moar 637241: OUTPUT«「dd」»
The greedy version works as expected:
<bartolin> r: say ("ddd" ~~ / [ x | d ] ** 2..3 /)
<camelia> rakudo-moar 637241, rakudo-jvm fb4f16: OUTPUT«「ddd」»
I was unable to golf it further, so the alternation seems to be needed to
produce the bug.