Here is some example without regular expressions:
var str = "5435%$% r3443_+_+**╥╡←";
var result = new string(str.Where(o => char.IsDigit(o)).ToArray());
//Or you can make code above slightly more compact, using following syntax:
var result = new string(str.Where(char.IsDigit).ToArray());
Selects from string everything, that is digit-character, and creates new string based on selection.
And speaking about speed.
var sw = new Stopwatch();
var str = "5435%$% r3443_+_+**╥╡←";
sw.Start();
for (int i = 0; i < 100000; i++)
{
var result = new string(str.Where(o => char.IsDigit(o)).ToArray());
}
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds); // Takes nearly 107 ms
sw.Reset();
sw.Start();
for (int i = 0; i < 100000; i++)
{
var s = Regex.Replace(str, @"\D", "");
}
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds); //Takes up to 600 ms
sw.Reset();
sw.Start();
for (int i = 0; i < 100000; i++)
{
var newstr = String.Join("", str.Where(c => Char.IsDigit(c)));
}
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds); //Takes up to 109 ms
So regular expression implementation works predictably slow. Join and new string gives pretty similar results, also it might very depending from use case. Did not test implementation with manual string looping, I believe, it might give best results.
Update.
Also there is RegexOptions.Compiled option for regular expression, usage from example was intended. But for clarity of test, can say, that compiled regular expression gives in example above nearly 150 ms performance boost, which is still pretty slow (4 times slower then other).