This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients crouleau, ezio.melotti, mrabarnett, tim.peters
Date 2012-07-31.19:14:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343762096.39.0.672429555027.issue15515@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-07-31 19:14:56tim.peterssetrecipients: + tim.peters, ezio.melotti, mrabarnett, crouleau
2012-07-31 19:14:56tim.peterssetmessageid: <1343762096.39.0.672429555027.issue15515@psf.upfronthosting.co.za>
2012-07-31 19:14:55tim.peterslinkissue15515 messages
2012-07-31 19:14:55tim.peterscreate