[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack overflow in regexp matcher

From: address@hidden
Subject: Re: Stack overflow in regexp matcher
Date: Thu, 17 Dec 2009 23:13:51 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20091204 Thunderbird/3.0

Barry Margolin wrote:
The problem is that + is greedy, so this has to scan the entire line
looking for the last "]", then see if there's an "=" somewhere later.
If it can't find an "=" it has to back up to the previous "]" and search
again, and so on.  If there are lots of "]" characters, this has to save
the state of each of them in the matching stack.

That's what I first suspected too.  But (a) the same thing happens with

    "^< \\([^]]+].+=|\\)"

which constrains the search to find only the first "]", and (b) there's only one "]" in that line -- within the first 45 characters -- as well as only a single "=|".

Any other thoughts?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]