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

Richard Meraz rfmeraz at gmail.com
Tue May 16 20:34:17 EDT 2006


Dear group members,

We need to capture more than 99 named groups using python regular
expressions.  From the docs and from this thread (
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a39a91b4bf8e3df4/2ad4a7e01b60215d?lnk=st&q=python+regular+expression+group+limit&rnum=3#2ad4a7e01b60215d)
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
sre_compile.py 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.

Thanks,
Richard Meraz





I realize this has been discussed before here:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a39a91b4bf8e3df4/2ad4a7e01b60215d?lnk=st&q=python+regular+expression+group+limit&rnum=3#2ad4a7e01b60215d


-- 
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: <http://mail.python.org/pipermail/python-list/attachments/20060516/e3ee04d6/attachment.html>


More information about the Python-list mailing list