Re: [pcre-dev] Start optimization issue

Page principale
Supprimer ce message
Auteur: Philip Hazel
Date:  
À: ND
CC: Pcre-dev
Sujet: Re: [pcre-dev] Start optimization issue
On Mon, 9 Jul 2012, ND wrote:

> And you are right: not only atomic group but some backtracking verbs gives
> same result.
> May be some code correction needed in those two places.


Yes. It seems that the .* optimization must be disabled if the .* is
inside an atomic group, or if *PRUNE or *SKIP is present in the pattern.
I will look at the code to see how best to do this.

> What kind of start optimization doing things? I don't find in
> documentation anything about this case.


The documentation does say this:

If a pattern starts with .* or .{0,} and the PCRE_DOTALL option
(equivalent to Perl's /s) is set, thus allowing the dot to match
newlines, the pattern is implicitly anchored, because whatever follows
will be tried against every character position in the subject string,
so there is no point in retrying the overall match at any position
after the first. PCRE normally treats such a pattern as though it were
preceded by \A.

It should probably say more about the case when PCRE_DOTALL option is
not set (I don't think it does, but I did not search very hard).

Philip

--
Philip Hazel