New submission from Cheryl Sabella <chek...@gmail.com>:

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)
<stdin>: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.

----------
assignee: docs@python
components: Documentation
messages: 310300
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Deprecation warning on strings used in re module
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32603>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to