正则语法:(30分钟入门教程)
http://deerchao.net/tutorials/regex/regex-1.htm
1、匹配外层中括号
(?i)(?<=\[)(.*)(?=\])
参照:(http://bbs.csdn.net/topics/380239087)
(http://book.51cto.com/art/200801/64658.htm)
2、匹配手机和身份证
Regex rgPHPone = new Regex(@"[1][3,4,5,8]\d{9}",RegexOptions.IgnoreCase | RegexOptions.Multiline);
Regex rgID = new Regex(@"\d{17}[a-zA-Z]|\d{18}|\d{15}");
或者:
身份证:^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d|x|X){4})$ 手机:^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$
原文链接:https://www.f2er.com/regex/359065.html