Re: [pcre-dev] Start optimization issue

Top Page
Delete this message
Author: ND
Date:  
To: Pcre-dev
Subject: Re: [pcre-dev] Start optimization issue
On 2012-07-09 10:51, Zoltán Herczeg wrote:
> > If DOTALL is set the result is the same. It seems that is_anchored()
> is in> action. I think PCRE must not assume such patterns as anchored.
>No.
>

Yes. Consider followed pattern:

PCRE version 8.31 2012-07-06
/(?>.*?a)b/sI
Capturing subpattern count = 0
Options: ANCHORED DOTALL
No first char
Need char = 'b'
aab
No match

There are to identical places in pcre_compile.c. One of them you already
describe:

/* .* means "start at start or after \n" if it isn't in brackets that
    may be referenced. */


and another is in is_anchored() procedure:

/* .* is not anchored unless DOTALL is set (which generates OP_ALLANY) and
    it isn't in brackets that are or may be referenced. */


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.