Skip to content

Commit 149748e

Browse files
authored
Fix Sphinx warnings in re module docs (#107044)
1 parent 5e4af2a commit 149748e

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Doc/library/re.rst

+18-5
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,8 @@ The special characters are:
501501
in the ASCII range (``b'\x00'``-``b'\x7f'``).
502502

503503

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

781783

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

@@ -1520,14 +1533,14 @@ Simulating scanf()
15201533

15211534
.. index:: single: scanf()
15221535

1523-
Python does not currently have an equivalent to :c:func:`scanf`. Regular
1536+
Python does not currently have an equivalent to :c:func:`!scanf`. Regular
15241537
expressions are generally more powerful, though also more verbose, than
1525-
:c:func:`scanf` format strings. The table below offers some more-or-less
1526-
equivalent mappings between :c:func:`scanf` format tokens and regular
1538+
:c:func:`!scanf` format strings. The table below offers some more-or-less
1539+
equivalent mappings between :c:func:`!scanf` format tokens and regular
15271540
expressions.
15281541

15291542
+--------------------------------+---------------------------------------------+
1530-
| :c:func:`scanf` Token | Regular Expression |
1543+
| :c:func:`!scanf` Token | Regular Expression |
15311544
+================================+=============================================+
15321545
| ``%c`` | ``.`` |
15331546
+--------------------------------+---------------------------------------------+
@@ -1552,7 +1565,7 @@ To extract the filename and numbers from a string like ::
15521565

15531566
/usr/sbin/sendmail - 0 errors, 4 warnings
15541567

1555-
you would use a :c:func:`scanf` format like ::
1568+
you would use a :c:func:`!scanf` format like ::
15561569

15571570
%s - %d errors, %d warnings
15581571

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ Doc/library/pyclbr.rst
174174
Doc/library/pydoc.rst
175175
Doc/library/pyexpat.rst
176176
Doc/library/random.rst
177-
Doc/library/re.rst
178177
Doc/library/readline.rst
179178
Doc/library/reprlib.rst
180179
Doc/library/resource.rst

0 commit comments

Comments
 (0)