Skip to content

Commit b711441

Browse files
authored
[3.11] Fix Sphinx warnings in re module docs (GH-107044). (#107055)
(cherry picked from commit 149748e)
1 parent c332117 commit b711441

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

Doc/library/re.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ The special characters are:
500500
(``b'\x00'``-``b'\x7f'``) in :class:`bytes` replacement strings.
501501

502502

503+
.. _re-special-sequences:
504+
503505
The special sequences consist of ``'\'`` and a character from the list below.
504506
If the ordinary character is not an ASCII digit or an ASCII letter, then the
505507
resulting RE will match the second character. For example, ``\$`` matches the
@@ -778,6 +780,17 @@ Flags
778780
Corresponds to the inline flag ``(?s)``.
779781

780782

783+
.. data:: U
784+
UNICODE
785+
786+
In Python 2, this flag made :ref:`special sequences <re-special-sequences>`
787+
include Unicode characters in matches. Since Python 3, Unicode characters
788+
are matched by default.
789+
790+
See :const:`A` for restricting matching on ASCII characters instead.
791+
792+
This flag is only kept for backward compatibility.
793+
781794
.. data:: X
782795
VERBOSE
783796

@@ -1518,14 +1531,14 @@ Simulating scanf()
15181531

15191532
.. index:: single: scanf()
15201533

1521-
Python does not currently have an equivalent to :c:func:`scanf`. Regular
1534+
Python does not currently have an equivalent to :c:func:`!scanf`. Regular
15221535
expressions are generally more powerful, though also more verbose, than
1523-
:c:func:`scanf` format strings. The table below offers some more-or-less
1524-
equivalent mappings between :c:func:`scanf` format tokens and regular
1536+
:c:func:`!scanf` format strings. The table below offers some more-or-less
1537+
equivalent mappings between :c:func:`!scanf` format tokens and regular
15251538
expressions.
15261539

15271540
+--------------------------------+---------------------------------------------+
1528-
| :c:func:`scanf` Token | Regular Expression |
1541+
| :c:func:`!scanf` Token | Regular Expression |
15291542
+================================+=============================================+
15301543
| ``%c`` | ``.`` |
15311544
+--------------------------------+---------------------------------------------+
@@ -1550,7 +1563,7 @@ To extract the filename and numbers from a string like ::
15501563

15511564
/usr/sbin/sendmail - 0 errors, 4 warnings
15521565

1553-
you would use a :c:func:`scanf` format like ::
1566+
you would use a :c:func:`!scanf` format like ::
15541567

15551568
%s - %d errors, %d warnings
15561569

0 commit comments

Comments
 (0)