Javascript String formatPhone()
formatPhone()
String.prototype.formatPhone = function () { var re = /\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})/g; var subst = '$1-$2-$3'; return this.replace(re, subst); };