[issue34304] clarification on escaping \d in regular expressions

2018-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want to replace %d with literal \d, you need to repeat the backslash 4 times: pattern = re.sub('%d', 'd+', pattern) or use a raw string literal and repeat the backslash 2 times: pattern = re.sub('%d', r'\\d+', pattern) Since the backsl

[issue34304] clarification on escaping \d in regular expressions

2018-08-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: The reported behavior is reproducible in master as well as of ea68d83933 but not on 3.6.0. I couldn't bisect to the exact commit between 3.7.0 and 3.6.0 where this change was introduced though. I can also see some deprecation warnings as below while

[issue34304] clarification on escaping \d in regular expressions

2018-08-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue34304] clarification on escaping \d in regular expressions

2018-07-31 Thread Saba Kauser
New submission from Saba Kauser : Hello, I have a program that works well upto python 3.6 but fails with python 3.7. import re pattern="DBMS_NAME: string(%d) %s" sym = ['\[','\]','\(','\)'] for chr in sym: pattern = re.sub(chr, '\\' + chr, pattern) print(pattern) pattern=re.sub('%s','.