[issue13723] Regular expressions: (?:X|\s+)*$ takes a long time

2012-11-07 Thread Mark Dickinson
Changes by Mark Dickinson : -- superseder: -> the re module can perform poorly: O(2**n) versus O(n**2) ___ Python tracker ___ ___ Pyt

[issue13723] Regular expressions: (?:X|\s+)*$ takes a long time

2012-01-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: I believe it is a known fact that repeated repeats, like (...+)*, make for slow matching (if they work at all) with the current re engine. [I would not be surprised if Perl does some special casing to (in effect at least) rewrite the re to your second version.

[issue13723] Regular expressions: (?:X|\s+)*$ takes a long time

2012-01-06 Thread Alex Gaynor
Changes by Alex Gaynor : -- nosy: +alex ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/

[issue13723] Regular expressions: (?:X|\s+)*$ takes a long time

2012-01-06 Thread Eric Promislow
New submission from Eric Promislow : This regular expression takes a few seconds to be evaluated against any text: (.*?)((?:X|\s+)*)$ This reg ex is much faster: (.*?)((?:X|\s)*)$ To be fair, Ruby's performance with the first regex is the same as Python's. PHP and JavaScript both fail to mat