I have a string when a telephone number is inputted - there is a mask so it always looks like (123) 456-7890 - I'd like to take the formatting out before saving it to the DB. I have it set up to only 10 charachters as nvarchar(10) - I only need it to be numbers like this 1234567890.
Another way to do it(basically replace every non number character with ""):
Dim phone as string = "(123) 456-7890 -" Dim match as string = Regex.Replace(phone, "[^\d]", "") Console.WriteLine(match)
This outputs to: 1234567890