Re: [pcre-dev] Optimizations when execution order is importa…

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: mavvma
CC: pcre-dev
Subject: Re: [pcre-dev] Optimizations when execution order is important
On Sat, 13 Dec 2008, mavvma@??? wrote:

> PCRE Callout documentation says: "You should be aware that, because of
> optimizations in the way PCRE matches patterns, callouts sometimes do
> not happen."
>
> In some cases if user inserts callout, he surely want to deal some
> action at this point. But due to such optimizations (they are
> PCRE-inside and may be unknown for user) expected order may be
> affected.


It is not the order that is affected. There are shortcuts to failure.
For example, if your pattern is /anything....A/ PCRE knows that there
must be an occurrence of the letter "A" somewhere in the subject string.
Before it even starts matching, it does a quick check. If it does not
find "A", the match fails before it even starts.

>And user have not any sureness about regexp behaviour. What do you
> think about adding a possibility (may be an option) to disable
> disorder optimizations, if regexp contains callout.


Without looking at the code, I am not sure how many optimizations would
affect callouts in this way. When I next look, which will not be for a
month or two, I will see if this is possible. I am not at all sure that
it will be easy to cover all cases.

Philip

--
Philip Hazel