Skip to content

Commit 11c61b5

Browse files
[3.13] gh-144694: Fix re.Match.group() doc claiming [1..99] range limit (GH-144696) (#145066)
gh-144694: Fix re.Match.group() doc claiming [1..99] range limit (GH-144696) The documentation incorrectly stated that numeric group arguments must be in the range [1..99]. This limit was removed in Python 3.5 (bpo-22437). Replace with "a positive integer" since the next sentence already documents the IndexError for out-of-range values. (cherry picked from commit 85021bc) Co-authored-by: Mohsin Mehmood <55545648+mohsinm-dev@users.noreply.github.com>
1 parent c2a1fcb commit 11c61b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/library/re.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,10 +1404,10 @@ when there is no match, you can test whether there was a match with a simple
14041404
result is a single string; if there are multiple arguments, the result is a
14051405
tuple with one item per argument. Without arguments, *group1* defaults to zero
14061406
(the whole match is returned). If a *groupN* argument is zero, the corresponding
1407-
return value is the entire matching string; if it is in the inclusive range
1408-
[1..99], it is the string matching the corresponding parenthesized group. If a
1409-
group number is negative or larger than the number of groups defined in the
1410-
pattern, an :exc:`IndexError` exception is raised. If a group is contained in a
1407+
return value is the entire matching string; if it is a positive integer, it is
1408+
the string matching the corresponding parenthesized group. If a group number is
1409+
negative or larger than the number of groups defined in the pattern, an
1410+
:exc:`IndexError` exception is raised. If a group is contained in a
14111411
part of the pattern that did not match, the corresponding result is ``None``.
14121412
If a group is contained in a part of the pattern that matched multiple times,
14131413
the last match is returned. ::

0 commit comments

Comments
 (0)