fast regex

Bryan bryanjugglercryptographer at yahoo.com
Tue May 11 04:50:19 EDT 2010


Lawrence D'Oliveiro wrote:
> “Fast regex” is a contradiction in terms. You use
> regexes when you want ease of definition and
> application, not speed.

Python or Perl regex's are not actually regular expressions. Real
regular expression compilers produce blazing fast results, but they
cannot support many of the features of offered by the search-and-
backtrack engines that Python and Perl use.

> For speed, consider hand-coding your own state
> machine. Preferably in a compiled language like C.

The speed of a real regular expression engine is hard to beat.

I assume you're not actually suggesting hand-writing a state machine
for the problem at issue here, which requires recognizing about 5000
different words.

--
--Bryan



More information about the Python-list mailing list