hi there,
i have a code to validate a tel number but the thing is i want it to restrict it for 10 digits. currently i can add any number of digits how can i restrict it to 10 digits
the code is below
public bool ValidateTelNo(string TelNo)
{
bool value = false;
string rePhoneNumber = @"[1-9]\d{2}\s?\d{3}\d{4}";
string PhoneNoFormat = @"\([1-9]{1}\d{2}\)\s?\d{3}\-\d{4}";
Regex re = new Regex(rePhoneNumber);
Regex re1 = new Regex(PhoneNoFormat);
if (re.IsMatch(TelNo) || (re1.IsMatch(TelNo)))
value = true;
else
value = false;
return value;
}
thanks
anisha