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);
}结果:
版权声明:本文为xz1414682954原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。