The main code to verify the phone number is as follows: Public BOOLIstelephone (stringstr_telephone) {ReturnSystem.Text.RegularExpressions.Regex.IsMatch (Str_telephone,@"^ (\d{3,4}-)? \d{6,8}$"); The main code to verify the phone number is as follows: Public BOOLIshandset (stringStr_handset) {ReturnSystem.Text.RegularExpressions.Regex.IsMatch (Str_handset,@"^[1]+[3,5]+\d{9}"); The main code to verify the ID number is as follows: Public BOOLIsidcard (Stringstr_idcard) {ReturnSystem.Text.RegularExpressions.Regex.IsMatch (Str_idcard,@"(^\d{18}$) | (^\d{15}$)"); Verify that the main code entered as a number is as follows: Public BOOLIsnumber (stringstr_number) {ReturnSystem.Text.RegularExpressions.Regex.IsMatch (Str_number,@"^[0-9]*$"); Verify that the main code of the postcode is as follows: PublicBoolispostalcode (stringStr_postalcode) {ReturnSystem.Text.RegularExpressions.Regex.IsMatch (Str_postalcode,@"^\d{6}$"); }
Use regular expressions in C # to verify phone numbers, phone numbers, social Security numbers