Re: [pcre-dev] Quantifying backtracking verbs

Page principale
Supprimer ce message
Auteur: ph10
Date:  
À: ND
CC: Pcre-dev
Sujet: Re: [pcre-dev] Quantifying backtracking verbs
On Mon, 17 Jun 2019, ND via Pcre-dev wrote:

> >If a pattern contains (*ACCEPT) the code for finding the minimum length
> >gives up because everything gets too complicated, and so the minimum is
> >0.
>
> Yes, it should. But it not 0, it is 2 in example from this thread:
>
> /A(?:(*ACCEPT))?B/info
> Capture group count = 0
> First code unit = 'A'
> Subject length lower bound = 2
> A
> No match
>
> So this pattern have (*ACCEPT) but subject_length_lower_bound is not 0.


Indeed! You have found a bug. The minimum length scan was not noticing
(*ACCEPT) because it skipped over the group with minimum zero repeat. I
have now changed the code so that it remembers (*ACCEPT) is present, and
so skips doing a length scan. However, the above example now gives 1
rather than zero, because it notices that there is a first code unit (a
recent change, suggested by you).

Thanks for the bug report.

Philip

--
Philip Hazel