Tim Peters added the comment: Yes, that example takes time exponential in the number of blanks to (fail to) match - each time you add a blank to `input`, it essentially doubles the time required.
It's _possible_ for an implementation to deduce that `(\s+)+` is an insanely inefficient way to spell `\s+`, like it's _possible_ for an implementation to deduce that 10**10**10 - 10**10**10 is an insanely inefficient way to spell 0. Python's does not. To understand what's going on, Friedl's book "Mastering Regular Expressions" is an excellent source. ---------- nosy: +tim.peters _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30148> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com