Or in case you want to handle each regexp differently, you can construct a dict {regexp : callback_function} that picks the rightaction depending on which regexp matched.
One word of caution: dicts are unsorted, so if more than one regexp can match a given line, they either need to map to the same function, or you need to use a list of regexp-to-functions (see my previous post) for a determinate order.
-tkc -- http://mail.python.org/mailman/listinfo/python-list