Java Regular Expressions

Source: Internet
Author: User

Chinese name, mobile number, ID number, phone and phone, Chinese, phone number:

1  Public classValidateutil {2     //Chinese name Regular expression3      Public Static FinalString Name_reg = "^ ([\\u4e00-\\u9fa5]+| ( [a-za-z]+\\s?] +)$";4 5     //mobile phone number Regular expression6      Public Static FinalString Phone_reg = "^ (13[\\d]{9}|15[\\d]{9}|17[\\d]{9}|18[\\d]{9}) $";7 8     //identity card Regular expression9      Public Static FinalString Idcard_reg = "(\\d{14}[0-9x]) | (\\d{17}[0-9x]) ";Ten  One     //verify both the phone number and phone number A      Public Static FinalString Mobile_reg = "(^ (\\d{3,4}-)? \\d{7,8}) $| (1[3|5|7|8|] [0-9] {9}) "; -  -     //Verify Chinese the      Public Static FinalString Chn_reg = "^[\\u4e00-\\u9fa5]{0,}$"; -  -     //phone number 3-4-digit area code, 7-8-digit live number, 1-4 poorly transposition machine number -      Public Static FinalString Tele_rec = "((\\d{11}) |^ ((\\d{7,8}) | ( \\D{4}|\\D{3})-(\\d{7,8}) | (\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}) | (\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})) "; +  -      +     /** A * Public parameter check method at      *  -      * @paramObject - * [Pass parameters] -      * @paramReg - * [Regular expression parameters] -      * @returnBoolean [Return type description] in      * @exceptionthrows [Type of violation] [description of violation] -      * @see[Class, Class # method, Class # member] to      */ +      Public Static Booleancommonvalidate (String object, String reg) { -         if(!object.matches (REG)) { the             return true; *         } $         return false;Panax Notoginseng     } -}

Java Regular Expressions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.