/*** 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