Rewrite replace_all.