how to remove spaces and a dash in c# string code example Example: c# replace dash in string string result = Regex.Replace(inputString, @"[^0-9]", "");