The main code to verify the phone number is as follows:
public bool Istelephone (string str_telephone)
{
Return System.Text.RegularExpressions.Regex.IsMatch (Str_telephone, @ "^ (\d{3,4}-) \d{6,8}$");
}
The main code to verify the phone number is as follows:
public bool Ishandset (string str_handset)
{
Return System.Text.RegularExpressions.Regex.IsMatch (Str_handset, @ "^[1]+[3,5]+\d{9}");
}
The main code to verify the ID number is as follows:
public bool Isidcard (string str_idcard)
{
Return System.Text.RegularExpressions.Regex.IsMatch (Str_idcard, @ "(^\d{17} (?: \ D|X) ($) | (^\d{15}$) ");
}
Verify that the main code entered as a number is as follows:
public bool Isnumber (string str_number)
{
Return System.Text.RegularExpressions.Regex.IsMatch (Str_number, @ "^[0-9]*$");
}
Verify the main code of the postcode as follows:
public bool Ispostalcode (string str_postalcode)
{
Return System.Text.RegularExpressions.Regex.IsMatch (Str_postalcode, @ "^\d{6}$");
}
Source Text Address: http://home.cnblogs.com/group/topic/55417.html
Use regular expressions in C # to verify phone numbers, phone numbers, social security numbers, numbers, and postal codes