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

2018-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, it is. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-11-07 Thread Stephan Bergmann
Stephan Bergmann added the comment: So, just to make sure, that also means that re.sub('a*$', 'b', 'a') returning 'bb' instead of 'b' is intended behavior? -- nosy: +Stephan Bergmann ___ Python tracker

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

2018-10-14 Thread purificant
purificant added the comment: Great, thank you for explaining. My specific use case can be fixed by replacing * with + as per your suggestion. -- ___ Python tracker ___

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

2018-10-14 Thread Serhiy Storchaka
Serhiy Storchaka 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

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

2018-10-14 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

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

2018-10-14 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks for the report. git bisect tells me this change was introduced with fbb490fd2f38bd817d99c20c05121ad0168a38ee (issue32308) # ../backups/bpo34982.py import re print(re.sub(r'(([^/]*)(/.*)?)', r'\2.zip/\1/', 'example')) # Running script at

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

2018-10-14 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-10-14 Thread purificant
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: >>>