> re.search(expr, string) compiles and searches every time. This can > potentially be more expensive in calculating power. especially if you > have to use the expression a lot of times.
The re module-level helper functions cache expressions and their compiled form in a dict. They are only compiled once. The main overhead would be for repeated dict lookups. See sre.py (included from re.py) for more details. /usr/lib/python2.4/sre.py -- http://mail.python.org/mailman/listinfo/python-list