--- In [email protected], "Sheri" <[EMAIL PROTECTED]> wrote:
> --- In [email protected], "Owen Watson" <o.m.watson@> wrote:
> >
> > I'm still a bit puzzled why .+<endstring> should be a lot lot
> > slower than \A.+<endstring> (I've removed all line endings so
> > they're irrelevant). Presumably .+ would start from the beginning
> > of the file and move forward, the same as \A.+


Hi Owen,

I've done a bit more research. I previously thought dotall (?s) was
set by default for the POSIX services. That is not true. The only PCRE
option preset in the POSIX interface is PCRE_DOLLAR_ENDONLY. When the
user also sets dotall, compliance with a POSIX standard is achieved.
The effect of PCRE_DOLLAR_ENDONLY is defeated when multiline (?m) is
specified. The multiline option affects the behavior of circumflex and
dollar metacharacters, not dot.

Even when the subject actually has no newlines, it is best to specify
(?s) to tell PCRE it doesn't need to test for newlines when matching
dots. See the section PROCESSING TIME on the page titled pcreperform
in the optional pcre.chm file.

PCRE does implicit anchoring when the pattern starts with .* and
dotall is set. It doesn't say the same for .+

If using the older plugin services, make sure replace, not replaceg
gets called. Otherwise, since the older services use a truncation
approach for locating multiple matches, the \A matches again, and the
second match attempt won't fail as quickly as possible.

Regards,
Sheri

Reply via email to