re.search much slower then grep on some regular expressions
Kris Kennaway
kris at FreeBSD.org
Thu Jul 10 06:21:31 EDT 2008
John Machin wrote:
> Uh-huh ... try this, then:
>
> http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
>
> You could use this to find the "Str" cases and the prefixes of the
> "re" cases (which seem to be no more complicated than 'foo.*bar.*zot')
> and use something slower like Python's re to search the remainder of
> the line for 'bar.*zot'.
If it was just strings, then sure...with regexps it might be possible to
make it work, but it doesn't sound particularly maintainable. I will
stick with my shell script until python gets a regexp engine of
equivalent performance.
Kris
More information about the Python-list
mailing list