Peter Otten added the comment:
This is not a bug; the signature of re.sub() is
sub(pattern, repl, string, count=0, flags=0)
and the fourth argument thus the 'count' delimiting the number of substitutions
that you accidentally specify as
>>> import re
>>> re.S
16
I recommend that you use a keyword arg to fix your code:
>>> re.sub('x', 'a', "x"*20, flags=re.S)
'aaaaaaaaaaaaaaaaaaaa'
----------
nosy: +peter.otten
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22760>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com