New submission from Michael Del Monte:
Easily reproduced:
re.sub('x', 'a', x*20, re.S)
returns ''
--
components: Regular Expressions
messages: 230216
nosy: ezio.melotti, mgdelmonte, mrabarnett
priority: normal
severity: normal
status: open
title: re.sub does only
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22760
___
___
Python-bugs-list
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
Georg Brandl added the comment:
The fourth parameter is not flags, but count, the max. number of
substitutions. flags is the fifth parameter, or give it as a keyword
argument.
--
nosy: +georg.brandl
resolution: - not a bug
status: open - closed
STINNER Victor added the comment:
This bug report is common. An enhancement would be to make the count parameter
a keyword only parameter. Would it break a lot of code?
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
Ezio Melotti added the comment:
See #11957.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22760
___
___
Python-bugs-list mailing list
Changes by STINNER Victor victor.stin...@gmail.com:
--
resolution: not a bug - duplicate
superseder: - re.sub confusion between count and flags args
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22760