[issue22437] re module: number of named groups is limited to 100 max

Serhiy Storchaka report at bugs.python.org
Thu Sep 18 22:36:02 CEST 2014


Serhiy Storchaka added the comment:

There is two reasons for this limitation. First reason is mentioned by David. There is no syntax to backreference a group with number > 99 (but there is a syntax for conditional groups and for substitutions). Second reason is that current implementation of regexp engine uses an array of constant size for groups.

Here is a patch which increases static limit to 1000 groups. It also allows to specify arbitrary group number in form of "(?P=number)". This is conformed to the syntax of conditional groups and for substitutions.

----------
keywords: +patch
Added file: http://bugs.python.org/file36654/re_maxgroups.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22437>
_______________________________________


More information about the Python-bugs-list mailing list