正则表达式无效?
我写的一个验证 11位电话号码的正则表达式,对于超过11位以上的数字无效,请大家指点
private bool CheckPhone(string phone) //检测电话号码
{
Regex r_Tel = new Regex(@"^\d{3}-\d{8}|\d{4}-\d{7}|\d{11}");
if (!r_Tel.IsMatch(phone))
{
return false;
}
else
return true;
}
在输入高位数的数字 居然能通过验证。例如:111111111111111 (15位数字),111111-1111111111 (6位-10位)
请问这是怎么回事?