2011/6/28 Morten Wang <nettrom@gmail.com>
As far as I can tell from looking at the code, the replacement is done by replaceExcept() in textlib.py, and the documentation there clearly states that you can use a function for replacing (there's a check if the replacement is a callable function, and if it is that function is called, thus working the same way as re.sub() does).

You have just opened a new horizon in front of me. I will do the test and then rewrite the documentation of replace.py if this works.