Pathological regular expression

MRAB google at mrabarnett.plus.com
Sat Apr 11 17:32:02 EDT 2009


Steven D'Aprano wrote:
> On Sat, 11 Apr 2009 08:40:03 -0700, John Machin wrote:
> 
>>> To my mind, this is a bug in the RE engine. Is there any reason to not
>>> treat it as a bug?
>> IMHO it's not a bug -- s/hang/takes a long time to compute/
>>
>> Just look at it: 2 + operators and 3 * operators ... It's one of those
>> "come back after lunch" REs.
> 
> Well, it's been running now for about two and a half hours, that's a 
> rather long lunch. And despite MRAB's assertion, it *cannot* be 
> interrupted by ctrl-C. That means that to all intents and purposes, the 
> interpreter has locked up for the duration of the calculation, which may 
> be days or weeks for all I know.
> 
I've just tried all 3 regexes in Python 2.5.2. All could be interrupted
by ctrl-C.



More information about the Python-list mailing list