[issue34982] re.sub() different behavior in 3.7

Serhiy Storchaka report at bugs.python.org
Sun Oct 14 10:08:48 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Yes, this is an intended change. Your pattern matches an empty string at the end of the input string. It was a bug in earlier Python versions that re.sub() didn't replace empty matches adjacent to a previous non-empty match.

It is not clear what is the purpose of your code, but adding anchors or replacing * with + usually helps.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34982>
_______________________________________


More information about the Python-bugs-list mailing list