Message292238
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. |
|
Date |
User |
Action |
Args |
2017-04-24 20:33:56 | tim.peters | set | recipients:
+ tim.peters, ezio.melotti, mrabarnett, jpakkane |
2017-04-24 20:33:56 | tim.peters | set | messageid: <1493066036.2.0.927759594789.issue30148@psf.upfronthosting.co.za> |
2017-04-24 20:33:56 | tim.peters | link | issue30148 messages |
2017-04-24 20:33:56 | tim.peters | create | |
|