minimalist regular expression

Paul McGuire ptmcg at
Fri Aug 26 15:13:04 CEST 2005

Google for "optimized regexp" returns:

There are several more links, but all appear to be written in languages
other than Python.  Perhaps you could port one of them.

It also seems that a similar thread came up here recently, at least in
the special form of converting a list of words to a single regexp.  In
general, this seems to be a difficult problem, not only to implement,
but to test.  At least the conversion of a list of words to a single
regexp is easily tested against the input set, although as some of the
other clever posters have noted, it is possible to create a regexp that
is *too* matchable.

-- Paul

More information about the Python-list mailing list