62,047
社区成员
发帖
与我相关
我的任务
分享
IList<string> resultList = new List<string>();
try {
Regex regexObj = new Regex(@"(?<!\d)(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}(?!\d)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
Match matchResult = regexObj.Match(subjectString);
while (matchResult.Success) {
resultList.Add(matchResult.Value);
matchResult = matchResult.NextMatch();
}
} catch (ArgumentException ex) {
// Syntax error in the regular expression
}
(?<!\d)(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}(?!\d)
List<string> list = new List<string> { "齐叶(13414566541),王紫(15987904234)", "齐叶(13414566541),15987904234" };
Regex reg = new Regex(@"1[35]\d{9}");
foreach (string s in list)
foreach (Match m in reg.Matches(s))
Console.WriteLine(m.Value);
List<string> list = new List<string> { "齐叶(13414566541),王紫(15987904234)", "齐叶(13414566541),15987904234" };
Regex reg = new Regex(@"(?:13|15)\d{9}");
foreach (string s in list)
foreach (Match m in reg.Matches(s))
Console.WriteLine(m.Value);
string str = "齐叶(13414566541),王紫(15987904234)";
Regex Expression = new Regex("13[0-9]{9}|15[0-9]{9}");
MatchCollection match = Expression.Matches(str);
foreach (Match m in match)
{
Response.Write(m.Value + "<br/>");
}
string input="字符串";
string s=@"^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}$";
if (Regex.IsMatch(input, s))
{
MessageBox.Show("符合!");
}