Re: [pcre-dev] (*THEN) works differently in Perl

Top Page
Delete this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] (*THEN) works differently in Perl
On Sun, 30 Jun 2019, ND via Pcre-dev wrote:

> PCRE2 version 10.33 2019-04-16
> /\A(?:.|..)(*THEN)c/
> abc
> No match
>
>
> Perl is match "abc".
> I suppose "next innermost alternative" is interpreted differently by PCRE and
> Perl.
>
> If so, may be PCRE should go Perl way in this matter?


I think this is a bug in Perl and I will report it as such. The Perl
document says, concerning (*THEN): "when backtracked into on failure, it
causes the regex engine to try the next alternation in the innermost
enclosing group (capturing or otherwise) that has alternations."

There is no group enclosing (*THEN) in your pattern. Perls' doc also
says this:

Note that if this operator is used and NOT inside of an alternation
then it acts exactly like the "(*PRUNE)" operator.

.. but it doesn't:

Perl 5.030000 Regular Expressions

/\A(?:.|..)(*THEN)c/
abc
0: abc

/\A(?:.|..)(*PRUNE)c/
abc
No match

Philip

--
Philip Hazel