not bad, haven't actually tested, but you could compress thsoe replace ident's into one.
$replace(str,x1,r1,x2,r2) etc.