[issue1761] Bug in re.sub()
Amaury Forgeot d'Arc
report at bugs.python.org
Tue Jan 8 10:54:56 CET 2008
Amaury Forgeot d'Arc added the comment:
In other words, if I understand correctly:
>>> re.sub('$', '#', 'a\nb\nc')
'a\nb\nc#'
>>> re.sub('$', '#', 'a\nb\n')
'a\nb#\n#'
The first sample is correct, but the second one find two matches, even
without the re.MULTILINE option.
Is this normal? The docs say:
> '$' Matches the end of the string or just before the newline at
> the end of the string [...]
It seems that it matches BOTH the end of the string AND just before the
newline at the end of the string.
----------
nosy: +amaury.forgeotdarc
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1761>
__________________________________
More information about the Python-bugs-list
mailing list