Skip to content

Commit

Permalink
Doc: Fix raw string notation reference
Browse files Browse the repository at this point in the history
  • Loading branch information
adorilson committed Oct 20, 2024
1 parent 12ecb3a commit f576282
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <raw-string-notation>`; 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
Expand Down

0 comments on commit f576282

Please sign in to comment.