[Python-checkins] gh-102111: Add link to string escape sequences in re module (#106995)
hugovk
webhook-mailer at python.org
Sun Jul 23 04:50:41 EDT 2023
https://github.com/python/cpython/commit/0af247da0932692592ed85ba8b4a1520627ab4ac
commit: 0af247da0932692592ed85ba8b4a1520627ab4ac
branch: main
author: wulmer <wulmer at users.noreply.github.com>
committer: hugovk <hugovk at users.noreply.github.com>
date: 2023-07-23T02:50:38-06:00
summary:
gh-102111: Add link to string escape sequences in re module (#106995)
Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>
files:
M Doc/library/re.rst
M Doc/reference/lexical_analysis.rst
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 629ee472cca68..3f03f0341d816 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -634,8 +634,8 @@ character ``'$'``.
single: \x; in regular expressions
single: \\; in regular expressions
-Most of the standard escapes supported by Python string literals are also
-accepted by the regular expression parser::
+Most of the :ref:`escape sequences <escape-sequences>` supported by Python
+string literals are also accepted by the regular expression parser::
\a \b \f \n
\N \r \t \u
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index 47062f86810e9..dde7ba1d941dc 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -549,6 +549,10 @@ retained), except that three unescaped quotes in a row terminate the literal. (
.. _escape-sequences:
+
+Escape sequences
+^^^^^^^^^^^^^^^^
+
Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string and
bytes literals are interpreted according to rules similar to those used by
Standard C. The recognized escape sequences are:
More information about the Python-checkins
mailing list