New implementation of re module

Piet van Oostrum piet at
Thu Jul 30 15:39:35 CEST 2009

>>>>> MRAB <python at> (M) wrote:

>M> Hi all,
>M> I've been working on a new implementation of the re module. The details
>M> are at, specifically from
>M> I've included a .pyd file for
>M> Python 2.6 on Windows if you want to try it out.

>M> I'm interested in how fast it is generally, compared with the current re
>M> module, but especially when faced with those 'pathological' regular
>M> expressions which seem to take a long time to finish, for example:

>M>"^(.+|D)*A$", "x" * 25 + "B")

>M> which on my PC (1.8GHz) takes 18.98secs with the re module but <0.01secs
>M> with this new implementation.

Is this version also going to use the Thompson approach?
Piet van Oostrum <piet at>
URL: [PGP 8DAE142BE17999C4]
Private email: piet at

More information about the Python-list mailing list