Skip to content

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

@cben

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dirtopic-regex

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions