advice modifying re library to support more than 100 named captures.

Richard Meraz rfmeraz at
Wed May 17 02:34:17 CEST 2006

Dear group members,

We need to capture more than 99 named groups using python regular
expressions.  From the docs and from this thread (
its clear why the language designers have decided on this limitation.  For
our system, however, it is essential that we be able to capture an arbitrary
number of groups.

Could anyone on the list suggest what parts of the library code make
assumptions about this restriction? We'd like to make some local changes to
the core library to allow us to continue the development of our system (we
don't want to switch to another language). We removed the condition in that raises an exception for compiled regexps with more than
100 groups.  This allowed us to compile a regular expression with more than
100 groups, but subsequent attempts to match or search with that regular
expression resulted in segfaults.

Richard Meraz

I realize this has been discussed before here:

Never think there is anything impossible for the soul. It is the greatest
heresy to think so. If there is sin, this is the only sin – to say that you
are weak, or others are weak.

Swami Vivekananda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list