Ezio Melotti <[email protected]> added the comment:
This behavior was changed in 3.7: "Empty matches for the pattern are replaced
only when not adjacent to a previous empty match, so sub('x*', '-', 'abxd')
returns '-a-b--d-'." [0]
See also bpo-32308 and bpo-25054.
[0]: https://docs.python.org/3/library/re.html#re.sub
----------
resolution: -> not a bug
stage: -> resolved
status: open -> closed
superseder: -> Replace empty matches adjacent to a previous non-empty match in
re.sub()
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41080>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com