Re: [pcre-dev] Start optimization issue

Top Page
Delete this message
Author: Zoltán Herczeg
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] Start optimization issue
> 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.

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

   else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR || op == OP_TYPEPOSSTAR)
     {
     if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
     }


This assumption is wrong for those .*-s, which are inside an atomic block, or bactracking is broken by some recursive control verb like this one:

re> /.*?a(*PRUNE)b/
data> aab

No match
data>
re> /(*NO_START_OPT).*?a(*PRUNE)b/
data> aab

0: ab

Regards,
Zoltan