Skip to content

docs: re.Match.group() does handle numbers >99 #144694

Description

@cben

Documentation

https://docs.python.org/3.14/library/re.html#re.Match.group

if it [groupN arg] is in the inclusive range [1..99], it is the string matching the corresponding parenthesized group.

Unlike \1..\99 notation, .group() is not constrained by 99.
It was constrained up to Python 3.4 (AssertionError: sorry, but this version only supports 100 named groups)
but not since 3.5 (9baa5b2, https://bugs.python.org/issue22437):

>>> re.search('()'*999 + '(y)', 'xy').group(99, 999, 1000)
('', '', 'y')
>>> _sre.MAXGROUPS
1073741823

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixesdocsDocumentation in the Doc dirtopic-regex

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions