@@ -395,9 +395,9 @@ The special characters are:
395
395
``(?P<name>...) ``
396
396
Similar to regular parentheses, but the substring matched by the group is
397
397
accessible via the symbolic group name *name *. Group names must be valid
398
- Python identifiers, and in bytes patterns they must contain only characters
399
- in the ASCII range. Each group name must be defined only once within a
400
- regular expression. A symbolic group is also a numbered group, just as if
398
+ Python identifiers, and in :class: ` bytes ` patterns they can only contain
399
+ bytes in the ASCII range. Each group name must be defined only once within
400
+ a regular expression. A symbolic group is also a numbered group, just as if
401
401
the group were not named.
402
402
403
403
Named groups can be referenced in three contexts. If the pattern is
@@ -419,8 +419,8 @@ The special characters are:
419
419
+---------------------------------------+----------------------------------+
420
420
421
421
.. versionchanged :: 3.12
422
- In bytes patterns group names must contain only characters in
423
- the ASCII range.
422
+ In :class: ` bytes ` patterns, group * name * can only contain bytes
423
+ in the ASCII range (`` b'\x00' ``-`` b'\x7f' ``) .
424
424
425
425
.. index :: single: (?P=; in regular expressions
426
426
@@ -496,6 +496,8 @@ The special characters are:
496
496
497
497
.. versionchanged :: 3.12
498
498
Group *id * can only contain ASCII digits.
499
+ In :class: `bytes ` patterns, group *name * can only contain bytes
500
+ in the ASCII range (``b'\x00' ``-``b'\x7f' ``).
499
501
500
502
501
503
The special sequences consist of ``'\' `` and a character from the list below.
@@ -1018,8 +1020,8 @@ Functions
1018
1020
1019
1021
.. versionchanged :: 3.12
1020
1022
Group *id * can only contain ASCII digits.
1021
- In bytes replacement strings group names must contain only characters
1022
- in the ASCII range.
1023
+ In :class: ` bytes ` replacement strings, group * name * can only contain bytes
1024
+ in the ASCII range (`` b'\x00' ``-`` b'\x7f' ``) .
1023
1025
1024
1026
1025
1027
.. function :: subn(pattern, repl, string, count=0, flags=0)
0 commit comments