Fix for Snow Leopard

Old python versions do not have flags support
in re.sub.