易丰科技

标题: c# regular express 找到文字中的数字 [打印本页]

作者: Calvin    时间: 2011-10-6 16:05
标题: c# regular express 找到文字中的数字
  1.             string reg = @"[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?";

  2.             string str = "dfgs4ae12r#@333";
  3.             System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(reg);
  4.             MatchCollection matches = regex.Matches(str);
复制代码






欢迎光临 易丰科技 (http://forum.yftek.com/) Powered by Discuz! X3