Find and extract a number from a string
\d+
is the regex for an integer number. So
//System.Text.RegularExpressions.Regex
resultString = Regex.Match(subjectString, @"\d+").Value;
returns a string containing the first occurrence of a number in subjectString
.
Int32.Parse(resultString)
will then give you the number.
Here's how I cleanse phone numbers to get the digits only:
string numericPhone = new String(phone.Where(Char.IsDigit).ToArray());