From f576282884f6262eb2bb4a489fc7a7acd662d46e Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 20 Oct 2024 23:12:54 +0100 Subject: [PATCH] Doc: Fix raw string notation reference --- Doc/library/re.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 6604a52a9ae0e2..68c30f920b2e2b 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -33,9 +33,9 @@ usage of the backslash in string literals now generate a :exc:`SyntaxWarning` and in the future this will become a :exc:`SyntaxError`. This behaviour will happen even if it is a valid escape sequence for a regular expression. -The solution is to use Python's :ref:`raw string notation ` -for regular expression -patterns; backslashes are not handled in any special way in a string literal +The solution is to use Python's :ref:`raw string notation +for regular expression patterns `; backslashes are not +handled in any special way in a string literal prefixed with ``'r'``. So ``r"\n"`` is a two-character string containing ``'\'`` and ``'n'``, while ``"\n"`` is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw