Javascript String Format Phone Number via Regex and replace()
replace()
let SearchText = "219.423.4432. 219 482 3423, 219-843-1244."; let myRegexp = /\b(\d{3})([- \.])(\d{3})\2(\d{4})\b/g; console.log( SearchText.replace(myRegexp, "$1-$3-$4") );