从字符串中删除字母字符和空格

Sac*_*nth 9 .net c#

我有一个包含许多字符的字符串.我想删除A-Za-z和白色空间,剩下的就剩下了.最好的方法是什么?

这是我尝试过的

presaleEstimateHigh = Regex.Replace(presaleEstimateHigh, @"[A-Za-z]", string.Empty);
Run Code Online (Sandbox Code Playgroud)

但我还需要删除空白区域.

Dan*_*Dan 10

你可以使用\ s.

例如:

presaleEstimateHigh = Regex.Replace(presaleEstimateHigh, @"[A-Za-z\s]", string.Empty);
Run Code Online (Sandbox Code Playgroud)