Issue 32603: Deprecation warning on strings used in re module (original) (raw)
I apologize if this is a duplicate question, but I couldn't find another issue about this. It's hard to search on 're'.
In 3.7, I get a deprecation warning when using a regular string with re escape characters:
s = '123abcd' re.findall('\d', s) :1: DeprecationWarning: invalid escape sequence \d ['1', '2', '3']
Of course, this works:
s = '123abcd' re.findall(r'\d', s) ['1', '2', '3']
I know that the documentation strongly suggests using raw strings with re, but I didn't see anywhere mentioning that it would be a requirement. I would think this would break a lot of 're' code.