C#: Remove all non numeric characters from a string using Regex

September 15, 2009 C# Regular expressions Snippet
using System.Text.RegularExpressions;
...
string newString = Regex.Replace(oldString, "[^.0-9]", "");
(If you don't want to allow the decimal delimiter in the final result, remove the . from the regular expression above).

Related posts: