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