Gadfly and regsub with Python 2.1
skip at pobox.com
Fri Nov 2 16:46:33 CET 2001
jim> Are there any pitfalls. an amateur should be aware of, in modifying
jim> Gadfly to use the "re" module?
It's pretty straightforward. You'll find that in most cases regsub.gsub can
simply be replaced with re.sub (modulo any necessary regex syntax changes)
and that regsub.sub can be replaced with re.sub after adding a count
parameter of 1.
I thought there was a regex->re converter script in the source distribution,
but I can't seem to locate it at the moment. If you can find it, you may
find it useful to convert more complex regular expressions.
Ah, wait a minute... Andrew Kuchling wrote a regex-to-re howto, available at
Skip Montanaro (skip at pobox.com)
More information about the Python-list