RE Engine error with sub()

Dennis Benzinger Dennis.Benzinger at gmx.net
Fri Apr 15 05:13:06 EDT 2005


Maurice LING schrieb:
> Hi,
> 
> I have the following codes:
> 
> from __future__ import nested_scopes
 > [...]

Are you still using Python 2.1?

In every later version you don't need the
"from __future__ import nested_scopes" line.

So, if you are using Python 2.1 I strongly recommend
upgrading to Python 2.4.1.

> [...]
> It all works well for rule count up to 800+ but when my replacement 
> rules swells up to 1800+, it gives me a runtime error that says 
> "Internal error in regular expression engine"... traceable to "return 
> self.regex.sub(self, text)" in substitute() method.
> [...]

I didn't read your code, but this sounds like you have a problem with 
the regular expression engine being recursive in Python versions < 2.4.
Try again using Python 2.4 or later (i.e. Python 2.4.1). The new regular 
expression engine is not recursive anymore.

Bye,
Dennis



More information about the Python-list mailing list