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 <rep...@bugs.python.org> <http://bugs.python.org/issue24071> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com