Extract numbers from string to create digit only string
You could write a simple method to extract out all non-digit characters, though this won't handle floating point data:
public string ExtractNumber(string original)
{
return new string(original.Where(c => Char.IsDigit(c)).ToArray());
}
This purely pulls out the "digits" - you could also use Char.IsNumber instead of Char.IsDigit, depending on the result you wish.
Try this oneliner:
Regex.Replace(str, "[^0-9 _]", "");