New submission from purificant :
A call to re.sub() returns different results in Python 3.7 compared to versions
3.6 / 3.5 and 2.7
Example behavior in 2.7 / 3.5 and 3.6:
>>> re.sub(r'(([^/]*)(/.*)?)', r'\2.zip/\1/', 'example')
'example.zip/example/'
Example in 3.7.0 and 3.7.1rc2:
>>> re.sub(r'(([^/]*)(/.*)?)', r'\2.zip/\1/', 'example')
'example.zip/example/.zip//'
As you can see the returned string is different for the same regex. re.subn()
confirms that 2 replacements are made instead of 1.
Is it intended to have different behaviour in 3.7+ or is this a bug?
Thanks
--
components: Regular Expressions
messages: 327707
nosy: ezio.melotti, mrabarnett, purificant
priority: normal
severity: normal
status: open
title: re.sub() different behavior in 3.7
versions: Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue34982>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com