using System; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Text; namespace SocketServer { public class myFunctions { private string ReformatPhone(string phone) { Match m = Regex.Match(phone, @"^\(?(\d{3})\)?[\s\-]?(\d{3})\-?(\d{4})$"); return String.Format("{0}-{1}-{2}", m.Groups[1], m.Groups[2], m.Groups[3]); } } }