Re: [pcre-dev] No capture in nested negative assertions

2018-07-10 Thread ND via Pcre-dev
On 2018-07-10 11:31, ph10 wrote: Perl 5.026002 Regular Expressions /(?!(a)b)/ a 0: 1: a /(?!(a)b|ac)/ a 0:/(?!ac|(a)b)/ a 0: It seems to save the capture only if there is just one branch in the assertion. Or maybe it has some algorithm for deciding on which branchto try first ... I don't

Re: [pcre-dev] No capture in nested negative assertions

2018-07-10 Thread ph10
On Tue, 10 Jul 2018, ND via Pcre-dev wrote: > I guess Perl doesn't backtrack if last alternative of negative assertion > fails. Not quite (see below). I suspect it is just the way the Perl code turned out rather than a deliberate design. I couldn't find any Perl documentation about this. >

Re: [pcre-dev] No capture in nested negative assertions

2018-07-09 Thread ND via Pcre-dev
On 2018-07-10 04:48, ND wrote: On 2018-07-09 09:25, ph10 wrote: >If any branch in a negative assertion succeeds, the captures are> (temporarily) kept, but as the whole assertion now fails, there is an> external backtrack, which discards the captures. > To what point backtracking is? I guess

Re: [pcre-dev] No capture in nested negative assertions

2018-07-09 Thread ND via Pcre-dev
On 2018-07-09 09:25, ph10 wrote: If any branch in a negative assertion succeeds, the captures are (temporarily) kept, but as the whole assertion now fails, there is an external backtrack, which discards the captures. To what point backtracking is? I guess Perl doesn't backtrack if last

Re: [pcre-dev] No capture in nested negative assertions

2018-07-09 Thread ph10
On Sun, 8 Jul 2018, ND via Pcre-dev wrote: > May I suggest alternative approach? It is simple and more consistent. I think > Perl use it: > > Capture is discarded ONLY if it was happen in non-matching branch. Actually, this is *exactly* what should already happen! I was going to post an

Re: [pcre-dev] No capture in nested negative assertions

2018-07-08 Thread ND via Pcre-dev
On 2018-07-07 16:50, ph10 wrote: I decided that the most straightforward approach was to discard all capturing inside negative assertions when the assertion completes. May I suggest alternative approach? It is simple and more consistent. I think Perl use it: Capture is discarded ONLY if

Re: [pcre-dev] No capture in nested negative assertions

2018-07-07 Thread ph10
On Fri, 6 Jul 2018, ND via Pcre-dev wrote: > PCRE documents: > "No capturing is done for a negative assertion unless it is being used as a > condition in a conditional subpattern (see the discussion below). Matching > continues after a non-conditional negative assertion only if all its branches >

[pcre-dev] No capture in nested negative assertions

2018-07-06 Thread ND via Pcre-dev
Good day. PCRE documents: "No capturing is done for a negative assertion unless it is being used as a condition in a conditional subpattern (see the discussion below). Matching continues after a non-conditional negative assertion only if all its branches fail to match." But capture