Regular expressions for Java matching phone formats

Source: Internet
Author: User

 /*** Mobile phone Number: There are currently 27 mobile phone number segments nationwide. * Mobile has 16 segments: 134, 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 182, 187, 188.     147, 157, 188 is the 3G, the other is the 2G number segment. * China Unicom has 7 types of segments: 130, 131, 132, 155, 156, 185, 186.     186 is the 3G (WCDMA) segment, the remainder is the 2G number segment. * Telecom has 4 segments: 133, 153, 180, 189.     Where 189 is the 3G segment (CDMA2000), segment 133th is mainly used as the wireless network card number.     * 150, 151, 152, 153, 155, 156, 157, 158, 1599;     * 130, 131, 132, 133, 134, 135, 136, 137, 138, 1390;     * 180, 182, 185, 186, 187, 188, 1897;     * 13, 15, 183 a total of 30 paragraphs, 154, 181, 183, 184 are not, plus 147 total 27. */    Private BooleanTelcheck (String tel) {Pattern P= Pattern.compile ("^ (13\\d{9}$) | ( 15[0,1,2,3,5,6,7,8,9]\\d{8}$) | (18[0,2,5,6,7,8,9]\\d{8}$) | (147\\d{8}) $) "); Matcher m=P.matcher (tel); returnm.matches (); }

Regular expressions for Java matching phone formats

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.