From: wulmer Date: Sun, 23 Jul 2023 08:50:38 +0000 (+0200) Subject: gh-102111: Add link to string escape sequences in re module (#106995) X-Git-Tag: v3.13.0a1~1271 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0af247da0932692592ed85ba8b4a1520627ab4ac;p=thirdparty%2FPython%2Fcpython.git gh-102111: Add link to string escape sequences in re module (#106995) Co-authored-by: Alex Waygood --- diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 629ee472cca6..3f03f0341d81 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 ` 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 47062f86810e..dde7ba1d941d 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: