summaryrefslogtreecommitdiffstats
path: root/Doc/library/re.rst
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-06-23 11:29:19 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-06-23 11:29:19 (GMT)
commit463badf06ce33d9de88dfea645c1253f44588aad (patch)
treefe3bf02bff59bfe3622237ede250fd74a06ee9ff /Doc/library/re.rst
parentc9aa8425c40e44362dd6abf0b60eb18b68539605 (diff)
downloadcpython-463badf06ce33d9de88dfea645c1253f44588aad.zip
cpython-463badf06ce33d9de88dfea645c1253f44588aad.tar.gz
cpython-463badf06ce33d9de88dfea645c1253f44588aad.tar.bz2
Issue #3665: \u and \U escapes are now supported in unicode regular expressions.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Doc/library/re.rst')
-rw-r--r--Doc/library/re.rst11
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index d8ead68..07623c9 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -414,17 +414,24 @@ Most of the standard escapes supported by Python string literals are also
accepted by the regular expression parser::
\a \b \f \n
- \r \t \v \x
- \\
+ \r \t \u \U
+ \v \x \\
(Note that ``\b`` is used to represent word boundaries, and means "backspace"
only inside character classes.)
+``'\u'`` and ``'\U'`` escape sequences are only recognized in Unicode
+patterns. In bytes patterns they are not treated specially.
+
Octal escapes are included in a limited form. If the first digit is a 0, or if
there are three octal digits, it is considered an octal escape. Otherwise, it is
a group reference. As for string literals, octal escapes are always at most
three digits in length.
+.. versionchanged:: 3.3
+ The ``'\u'`` and ``'\U'`` escape sequences have been added.
+
+
.. _contents-of-module-re: