jquery replace multiple strings code example
Example: jquery replace multiple words
// jQuery search and replace space in 10 digit phone number with dots (.)
(".some-class").each(function() {
var text = $(this).html();
// Start search at "Phone: " then 3 digits space 3 digits space 4 digits
// "Phone: 901 123 4567" -> "Phone: 901.123.4567"
text = text.replace(/Phone: (\d{3}) (\d{3}) (\d{4})/, "Phone: $1.$2.$3");
$(this).html(text);
});