取字符串中连续数字
string strTemp = "asgdgdsh211021199511115689gghjwbfewbgj15888888888jgndmnbkbgvadsngksgnjg19951111dsjhfjbfdebgjekwnboiweas1.85,dsamgndkngkdnemg";
System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(strTemp, "\\d+");
foreach (System.Text.RegularExpressions.Match match in mc)
{
if(match.Value.ToString().Length == 15 ||match.Value.ToString().Length == 18)
{
MessageBox.Show(match.Value.ToString() + "身份证号码");
}
if (match.Value.ToString().Length == 11)
{
MessageBox.Show(match.Value.ToString() + "手机号码");
}
}
摘自QQ群《动软俱乐部-5群》
System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(strTemp, "\\d+");
foreach (System.Text.RegularExpressions.Match match in mc)
{
if(match.Value.ToString().Length == 15 ||match.Value.ToString().Length == 18)
{
MessageBox.Show(match.Value.ToString() + "身份证号码");
}
if (match.Value.ToString().Length == 11)
{
MessageBox.Show(match.Value.ToString() + "手机号码");
}
}
摘自QQ群《动软俱乐部-5群》