[regex-coach] Re: RegEx coach and selecting from the top view

Edi Weitz edi at agharta.de
Tue Sep 20 13:08:02 UTC 2005


[Please use the mailing list for bug reports and other things.]

Hi!

On Mon, 19 Sep 2005 11:40:13 +0000, Björn Róbertsson <bjornr at simi.is> wrote:

> When I select a part of or the whole regular expression the CPU load
> goes up to 100 % and habitually the best way is to do End Task.
>  
> The machine runs Windows XP, firewall, antivirus et. al.
>  
> I am including a screenshot of one particular regexp which exhibits
> this behaviour.
>  
> This is a cpu graph, the tops (100%) occur when: the window is
> brought into focus while the regexp is highlighted, also when the
> regexp is highlighted (i.e. from back to front), when it’s changed,
> when the window is moved and so on.
>  
> I do not believe my regular expression to be very complicated but
> something is not right.

Your regular expression (that I include here for reference)

  ^\S+.*\S+.*\S+.*\d+\:\d+\:\d+ \d+ ([\.0-9]+\.1\.13\.10) Normal.*\" ([\.0-9]+) -.* ([\.0-9]+)

is formed in a way that leads to an exponential growth in backtracking
- the behaviour that you see is what I would expect.  Note that in
particular each ".*" forces the engine to go to the end of the target
string and from there retry each position backwards.  These attempts
will be nested.  Try the stepper to see what I mean.

You should rewrite the regex to avoid this.

Cheers,
Edi.



More information about the regex-coach mailing list