javascript replace all instances of substring in string