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