Skip to content

Commit 386d148

Browse files
committed
Add information about DeprecationWarning for invalid scaped characters in the re module
1 parent 1211c9a commit 386d148

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Doc/library/re.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ The special characters are:
162162

163163
If you're not using a raw string to express the pattern, remember that Python
164164
also uses the backslash as an escape sequence in string literals; if the escape
165-
sequence isn't recognized by Python's parser, the backslash and subsequent
166-
character are included in the resulting string. However, if Python would
167-
recognize the resulting sequence, the backslash should be repeated twice. This
168-
is complicated and hard to understand, so it's highly recommended that you use
169-
raw strings for all but the simplest expressions.
165+
sequence isn't recognized by Python's parser, it will generate a
166+
:exc:`DeprecationWarning` and in the future this will become a :exc:`Syntaxerror`.
167+
However, if Python would recognize the resulting sequence, the backslash should
168+
be repeated twice. This is complicated and hard to understand, so it's highly
169+
recommended that you use raw strings for all but the simplest expressions.
170170

171171
``[]``
172172
Used to indicate a set of characters. In a set:

0 commit comments

Comments
 (0)