Matthew Barnett added the comment:
The 4th parameter is the count, not the flags:
sub(pattern, repl, string, count=0, flags=0)
>>> re.sub(r'X.', '+', '-X\n-', flags=re.DOTALL)
'-+-'
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
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.mel