[New-bugs-announce] [issue24071] Python 2.7.8, 2.7.9 re.MULTILINE failure

Stephen Evans report at bugs.python.org
Tue Apr 28 21:25:28 CEST 2015


New submission from Stephen Evans:

A simple multiline regex fails when just the re.MULTILINE argument is used, but works when equivalent alternative methods are used. This was tested on Python2.7.8 on FreeBSD and Win32 Python2.7.9

data = re.sub(r'#.*', '', text, re.MULTILINE) # fails

data = re.sub(r'(?m)#.*', '', text) # Ok
data = re.sub(r'#.*', '', text, re.MULTILINE|re.DEBUG) # Ok

All the expressions work correctly with Win64 Python3.4.3
The attached file has the code and with a sample of text that fails.

----------
components: Regular Expressions
files: refail.py
messages: 242205
nosy: Stephen.Evans, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Python 2.7.8, 2.7.9  re.MULTILINE failure
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file39229/refail.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24071>
_______________________________________


More information about the New-bugs-announce mailing list