Tim Peters added the comment:

Matthew is right:  the nested quantifiers can cause this to take a very long 
time when the regexp doesn't match.  Note that the example cannot match, 
because nothing in the regexp can match the space before "warning" in the 
example string.  But the nested quantifiers cause it to _try_ an enormous 
number of futile attempts.

Under Python 2.7.1, it eventually does return, but it took over 15 minutes when 
I tried it on my laptop.

Friedl's book "Mastering Regular Expressions" is a book-length treatment of how 
to write regexps that don't "take forever" when they fail to match, and that's 
highly recommended.  Or start a discussion on comp.lang.python, and I'm sure 
someone will help you flesh out exactly what it is you do and don't want to 
match, and how to write a regexp that performs well on both matching and 
non-matching text (the bug tracker isn't an appropriate place for this).

----------
nosy: +tim_one
resolution:  -> invalid

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15515>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to