Http://www.cnblogs.com/wuhuisheng/archive/2011/03/23/1992652.html
The main code for phone number verification 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 used to verify the mobile 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 for verifying the ID card number is as follows:
Public bool isidcard (string str_idcard)
{
Return System. Text. regularexpressions. RegEx. ismatch (str_idcard, @ "(^ \ D {18} $) | (^ \ D {15} $ )");
}
The main code for verifying that the input is a number is as follows:
Public bool isnumber (string str_number)
{
Return System. Text. regularexpressions. RegEx. ismatch (str_number, @ "^ [0-9] * $ ");
}
The main code to verify the zip code is as follows:
Public bool ispostalcode (string str_postalcode)
{
Return System. Text. regularexpressions. RegEx. ismatch (str_postalcode, @ "^ \ D {6} $ ");
}
/// <Summary>
/// Verify the email address
/// </Summary>
/// <Param name = "str_email"> </param>
/// <Returns> </returns>
Public bool isemail (string str_email)
{
Return System. text. regularexpressions. regEx. ismatch (str_email, @ "\ W {1, }@\\ W {1 ,}\\. \ W {1 ,}");
}
-- From the C # programming dictionary