Is there a maximum length of a regular expression in python?

Fredrik Lundh fredrik at pythonware.com
Thu Jan 19 18:09:30 EST 2006


Frithiof Andreas Jensen wrote:

> > I have a regular expression that is approximately 100k bytes. (It is
> > basically a list of all known norwegian postal numbers and the
> > corresponding place with | in between. I know this is not the intended
> > use for regular expressions, but it should nonetheless work.
>
> Err. No.
>
> A while back it was established in this forum that re's per design can have
> a maximum of 99 match groups ... I suspect that every "|" silently consumes
> one match group.

nope.  this is a code size limit, not a group count limit.

</F>






More information about the Python-list mailing list