New submission from Harry Bock:

In Python 2.7.5, running re.search on regular expressions beginning with '.+' 
will raise RuntimeError if:
 * the string being matched is empty
 * the flags include re.DOTALL/re.S

>>> re.search(".+a", "", flags=re.S)
  File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 
2731, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
  File "<ipython-input-16-fefa32a418ba>", line 1, in <module>
    myre.search("")
RuntimeError: internal error in regular expression engine

This does not occur if the input string is not empty, or if re.match is used 
instead of re.search, or if the re.S flag is omitted.

The bug does not occur on previous versions of Python 2.x, including 2.7.4.

----------
components: Regular Expressions
messages: 190966
nosy: ezio.melotti, hbock, mrabarnett
priority: normal
severity: normal
status: open
title: RuntimeError raised with re.search + re.DOTALL on empty string
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18190>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to