正则表达式匹配含有空的的一个字符串

来源:互联网 发布:域名whois怎样查询 编辑:程序博客网 时间:2024/05/19 13:21
public ActionResult a()        {            string a = @"sdasld 1a23 ashdia";//需要匹配的字符串            string b = @"[^123]";//正则表达式 TP:[^123]:匹配括号外的所有字符            MatchCollection mc = Regex.Matches(a, b);            string lst = "";            foreach (Match m in mc)            {                lst+=m;               }            return Json(new { lst = lst }, JsonRequestBehavior.AllowGet);        }

结果:
阅读全文
0 0
原创粉丝点击