日期:2014-05-18  浏览次数:20888 次

请问,这个正则表达式,哪里错了?
static void Main(string[] args)
  {
  string pattern = @"\b+";
  Regex rgx = new Regex(pattern);
  string sentence = "dfgs4aer25#@";
  foreach (Match match in rgx.Matches(sentence)) //foreach遍历所有匹配项
  {
  Console.WriteLine(match.Value);  
  }
  Console.ReadKey();
  }

这个正则表达式,是搜索字符串"dfgs4aer25#@"中的所有数字,应该是4和25,为什么最后没有输出结果呢?哪里出错了?

------解决方案--------------------
\d+
------解决方案--------------------
探讨
\d+

------解决方案--------------------
1楼正解。\d是数字