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