@@ -501,6 +501,8 @@ The special characters are:
501
501
in the ASCII range (``b'\x00' ``-``b'\x7f' ``).
502
502
503
503
504
+ .. _re-special-sequences :
505
+
504
506
The special sequences consist of ``'\' `` and a character from the list below.
505
507
If the ordinary character is not an ASCII digit or an ASCII letter, then the
506
508
resulting RE will match the second character. For example, ``\$ `` matches the
@@ -779,6 +781,17 @@ Flags
779
781
Corresponds to the inline flag ``(?s) ``.
780
782
781
783
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
+
782
795
.. data :: X
783
796
VERBOSE
784
797
@@ -1520,14 +1533,14 @@ Simulating scanf()
1520
1533
1521
1534
.. index :: single: scanf()
1522
1535
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
1524
1537
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
1527
1540
expressions.
1528
1541
1529
1542
+--------------------------------+---------------------------------------------+
1530
- | :c:func: `scanf ` Token | Regular Expression |
1543
+ | :c:func: `! scanf ` Token | Regular Expression |
1531
1544
+================================+=============================================+
1532
1545
| ``%c `` | ``. `` |
1533
1546
+--------------------------------+---------------------------------------------+
@@ -1552,7 +1565,7 @@ To extract the filename and numbers from a string like ::
1552
1565
1553
1566
/usr/sbin/sendmail - 0 errors, 4 warnings
1554
1567
1555
- you would use a :c:func: `scanf ` format like ::
1568
+ you would use a :c:func: `! scanf ` format like ::
1556
1569
1557
1570
%s - %d errors, %d warnings
1558
1571
0 commit comments