[issue27471] sre_constants.error: bad escape \d

2016-10-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: All behaves as purposed. But the documentation is not accurate, and even misleading. It should be enhanced (issue28450). -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue27471] sre_constants.error: bad escape \d

2016-07-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is a deprection warning in 3.5. $ python3.5 -Wd >>> import re >>> re.sub(re.escape(r'(\d+?)'), '(?:\d+?)', r'(\d+?)') /usr/lib/python3.5/re.py:182: DeprecationWarning: bad escape \d return _compile(pattern, flags).sub(repl, string, count) '(?:\\d+?)'

[issue27471] sre_constants.error: bad escape \d

2016-07-08 Thread R. David Murray
R. David Murray added the comment: It's just supposed to be a warning at this point, though, so this looks like a bug. -- nosy: +r.david.murray ___ Python tracker

[issue27471] sre_constants.error: bad escape \d

2016-07-08 Thread Matthew Barnett
Matthew Barnett added the comment: There's a move to treat invalid escape sequences as an error (see issue 27364). The previous behaviour was to treat them as literals. The replacement template string contains \d, which is not a valid escape sequence (it's valid for the pattern, but not the

[issue27471] sre_constants.error: bad escape \d

2016-07-08 Thread Noah Petherbridge
New submission from Noah Petherbridge: I found a bug in Python 3.6.0a2 that wasn't present on previous versions of Python concerning the "\d" escape sequence as used in the following regular expression: import re s = "hello" s = re.sub(re.escape(r'(\d+?)'), '(?:\d+?)', s) (The purpose of