Regex error?

limodou chatme at 263.net
Thu Jun 7 20:13:40 EDT 2001


Drew Fisher <drew at level3.net> wrote in message news:<mailman.991924577.21282.python-list at python.org>...
> Hi,
> 
> I'm trying to write a python script to parse an email header for IP
> addresses and dates, and I keep on getting an error that says:
> 
> RuntimeError: maximum recursion limit exceeded
> 
> The regex is a little lengthy, but I didn't think it would be a
> problem:
> 
> rfc822_re = re.compile ('\[(\d+\.\d+\.\d+\.\d+)\].*?\w+,\s+(\d+\s+\w+\s+\d+)\s+(\d+:\d+:\d+)\s+(\w+)')
> 
> The script dies when I try to do:
> 
> rfc822_test = rfc822_re.findall (rawdata)
> 
> rawdata is just a string containing the entire email.
> 
> The regex finds the IP address, the date, the time, and the timezone
> from where the email address came.
> 
> Can anyone tell me what that error means, and how I could possibly get
> around it?
> 
> Thanks,
> 
> Drew Fisher

I'v met this error too, and I found that once you reduce the length of
the string the error will disappear. I think it may be a bug, and the
length may be limited in 16K. I don't know whether my thought is
right.



More information about the Python-list mailing list