[Python-ideas] Matching multiple regex patterns simultaneously

Stefan Behnel stefan_ml at behnel.de
Wed Mar 3 09:37:27 CET 2010


M.-A. Lemburg, 02.03.2010 23:09:
> If you only need to search for a finite set of words, there are few
> good algorithms for this:
>
> http://en.wikipedia.org/wiki/Aho-Corasick_algorithm
>   * used in Unix fgrep
>   * Python implementation:
>     http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
>
> http://en.wikipedia.org/wiki/Rabin-Karp_string_search_algorithm#Rabin.E2.80.93Karp_and_multiple_pattern_search
>   * uses hashing

... and acora:

http://pypi.python.org/pypi/acora

Stefan




More information about the Python-ideas mailing list