[New-bugs-announce] [issue41555] re.sub replaces twice

S. Zhang report at bugs.python.org
Fri Aug 14 18:28:33 EDT 2020

New submission from S. Zhang <spz1st at gmail.com>:

The following command produced "name.tsvtsv" with version 3.7.1 and 3.8.5 instead of the expected "name.tsv" from version 2.7.5, 3.5.6, and 3.6.7.  Changing * to + produced expected "name.tsv".

python -c 'import re; v="name.txt";v = re.sub("[^\.]*$", "tsv", v);print(v)'

messages: 375436
nosy: spz1st
priority: normal
severity: normal
status: open
title: re.sub replaces twice
type: behavior
versions: Python 3.7, Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list