This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author malin
Recipients ezio.melotti, malin, mrabarnett, veaba
Date 2019-10-24.13:32:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571923972.79.0.67132790957.issue38582@roundup.psfhosted.org>
In-reply-to
Content
An simpler reproduce code:

```
import re

NUM = 99

# items = [ '(001)', '(002)', '(003)', ..., '(NUM)']
items = [r'(%03d)' % i for i in range(1, 1+NUM)]
pattern = '|'.join(items)

# repl = '\1\2\3...\NUM'
temp = ('\\' + str(i) for i in range(1, 1+NUM))
repl = ''.join(temp)

text = re.sub(pattern, repl, '(001)')
print(text)

# if NUM == 99
# output: (001)
# if NUM == 100
# output: (001@)
# if NUM == 101
# output: (001@A)
```
History
Date User Action Args
2019-10-24 13:32:52malinsetrecipients: + malin, ezio.melotti, mrabarnett, veaba
2019-10-24 13:32:52malinsetmessageid: <1571923972.79.0.67132790957.issue38582@roundup.psfhosted.org>
2019-10-24 13:32:52malinlinkissue38582 messages
2019-10-24 13:32:52malincreate