Re: [pcre-dev] Quantifying backtracking verbs

Top Page
Delete this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] Quantifying backtracking verbs
On Sun, 16 Jun 2019, ND via Pcre-dev wrote:

> A following example was included in docs (pcre2pattern.html) :
>
> A(*ACCEPT)??BC
>
> But this example does not show what we can do with (*ACCESS)?? that can't
> doing well with another PCRE facilities.
> I suggest to show in docs another example that was posted earlier in this
> thread:
>
> (a(*ACCEPT)??b)c
>
> In this example we want to match "abc" or "a" AND capture all but "c".


I have updated the doc to use your example, but it can be done easily
with other PCRE2 facilities:

(?|(ab)c|(a))

does the same thing. If "a" is complex, and you do not want to write it
out twice, you could DEFINE it and use a subroutine call.

Philip

--
Philip Hazel