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

2017-07-13 Thread Matthew Barnett
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 ___

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

2017-07-13 Thread Robert
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