Python and regexp efficiency.. again.. :)
Patrick Tufts
zippy at cs.brandeis.edu
Sat Dec 11 02:22:16 EST 1999
In article <al8n1rj6tgv.fsf at sirppi.helsinki.fi>, Markus Stenberg
<mstenber at cc.Helsinki.FI> wrote:
> One order of magnitude optimization gain was received by writing
> a specialized regexp optimization tool - as the regexps are mostly
> of type
>
> ^commonstringuniquetail
> ^commonstringanothertail
Depending on how many different extensions there are to commonstring,
you might do better with the regexp:
^commonstring(.*)
and then matching the saved pattern (.*) against a dictionary of
possible extensions.
--Pat
More information about the Python-list
mailing list