[issue13723] Regular expressions: (?:X|\s+)*$ takes a long time
Eric Promislow
report at bugs.python.org
Fri Jan 6 22:43:56 CET 2012
New submission from Eric Promislow <ericp at activestate.com>:
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 match the first regex
at all. Only Perl evaluates both regexes nearly instantly.
----------
messages: 150770
nosy: ericp
priority: normal
severity: normal
status: open
title: Regular expressions: (?:X|\s+)*$ takes a long time
type: performance
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13723>
_______________________________________
More information about the Python-bugs-list
mailing list