@mwhite 
I read that re.sub method doesn't support keywords arguments in the python 2.6, but I could be wrong. I added re.compile, and I think it is ok now.