Re: [pcre-dev] Bactracking controls in subroutines

Top Page
Delete this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] Bactracking controls in subroutines
On Tue, 3 Jul 2018, ND via Pcre-dev wrote:

> PCRE2 version 10.31 2018-02-12
> /(?1)(*F)|(a(*COMMIT))/
> a
> 0: a
> 1: a
>
>
> In Perl this pattern not matched.
>
> There are differences in how PCRE and Perl act with control verbs in
> subroutines.
> This is documented in PCRE:
> "Perl's treatment of subroutines is different in some cases.


The documentation doesn't seem right, even with the current code. When
pcre2_match() was upgraded not to use the system stack, backtracking
into subroutines came as a by-product. I probably didn't really consider
the backtracking verbs at that time.

Thank you for noticing the odd effect. I will investigate in due course,
when I get time.

> ...
> (*COMMIT), (*SKIP), and (*PRUNE) in a subpattern called as a subroutine cause
> the subroutine match to fail."


... but in your example it succeeds! So something is definitely wrong.

Philip

--
Philip Hazel