String.replace in Javascript only replaces first occurrence by default.