On Wed, 5 Jun 2019, I wrote:
> On Wed, 5 Jun 2019, ND via Pcre-dev wrote:
>
> > It's not true for (*ACCEPT).
> > Construct "(*ACCEPT)??" is like a negated (*COMMIT) pattern:
> > (*COMMIT) immediately fail a whole match when backtrack to it occurs
> > (*ACCEPT)?? immediately match when backtrack to it occurs
>
> Ah, that is an interesting feature that I had not though of. I agree it
> could be useful and will consider how to implement it. Thank you for the
> insight.
Perl gets it wrong:
Perl 5.028001 Regular Expressions
/(a(?:(*ACCEPT))??bc)/
abc
0: abc
axy
No match
/a(*ACCEPT)??bc/
abc
0: abc
axy
No match
PCRE does get it right when parentheses are used:
PCRE2 version 10.34-RC1 2019-04-22
/(a(?:(*ACCEPT))??bc)/
abc
0: abc
axy
0: a
The simplest fix for PCRE2 is to change (*ACCEPT)<quantifier> into
(?:(*ACCEPT))<quantifier> at compile time. This avoids any
implementation requirement at match time and in the JIT.