Safe to change SRE config to allow more than 100 groups?
Fredrik Lundh
fredrik at pythonware.com
Tue Feb 20 02:45:41 EST 2001
Aaron Freeman wrote:
> I have an egregiously long regex, and I'm getting "AssertionError:
> sorry, but this version only supports 100 named groups" from SRE.
>
> After looking at SRE_Compile.py, I found where this is hardcoded to
> 100 (line 367), but but couldn't figure out why this was the arbitrary
> limitation.
>
> I tried changing it to 1000, and everything seemed to work fine
I doubt you ran it with 1000 named groups... if you do,
you'll overrun buffers inside the _sre engine. look in the
C sources for details.
> I also changed the maxcashe size in sre.py to 1000
if you have that many individual patterns, you're probably better
off compiling them in your script.
Cheers /F
More information about the Python-list
mailing list