[New-bugs-announce] [issue30927] re.sub() does not work correctly on '.' pattern and \n

Robert report at bugs.python.org
Thu Jul 13 17:27:56 EDT 2017


New submission from Robert:

When running the command

    re.sub(r'X.', '+', '-X\n-', re.DOTALL)

you get '-X\n-' instead of '-+-'.

Curiously findall works correctly:

    re.findall(r'X.', '-X\n-', re.DOTALL) => ['X\n']

----------
components: Regular Expressions
messages: 298316
nosy: ezio.melotti, mrabarnett, mrh1997
priority: normal
severity: normal
status: open
title: re.sub() does not work correctly on '.' pattern and \n
type: behavior
versions: Python 3.6

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


More information about the New-bugs-announce mailing list