Replace all instances in a JavaScript string