much slower then grep on some regular expressions

Henning_Thornblad Henning.Thornblad at
Fri Jul 4 13:43:48 CEST 2008

What can be the cause of the large difference between and

This script takes about 5 min to run on my computer:
#!/usr/bin/env python
import re

for a in range(156000):
print'[^ "=]*/',row)

While doing a simple grep:
grep '[^ "=]*/' input                  (input contains 156.000 a in
one row)
doesn't even take a second.

Is this a bug in python?

Henning Thornblad

More information about the Python-list mailing list