一、目前的号码段(2016-12-8更新)
二、代码
- package com.test;
-
- import java.util.regex.Pattern;
-
- public class CheckPhone {
-
-
- private static final String PHONE_CALL_PATTERN = "^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(-\\d{1,4})?$";
-
-
- private static final String CHINA_TELECOM_PATTERN = "(^1(33|53|7[37]|8[019])\\d{8}$)|(^1700\\d{7}$)";
-
-
- private static final String CHINA_UNICOM_PATTERN = "(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^170[7-9]\\d{7}$)";
-
-
- private static final String CHINA_MOBILE_PATTERN = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)";
-
-
- private static final String PHONE_PATTERN=new StringBuilder(300).append(CHINA_MOBILE_PATTERN)
- .append("|")
- .append(CHINA_TELECOM_PATTERN)
- .append("|")
- .append(CHINA_UNICOM_PATTERN)
- .toString();
-
-
- private static final String PHONE_TEL_PATTERN=new StringBuilder(350).append(PHONE_PATTERN)
- .append("|")
- .append("(")
- .append(PHONE_CALL_PATTERN)
- .append(")")
- .toString();
-
-
- private static final String MULTI_PHONE_TEL_PATTERN="^(((?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d{8})|(?:170[057-9]\\d{7})|(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(-\\d{1,4})?)[,\\s、]?)+(?<![,、\\s])$";
-
-
- public static boolean isPhone(String input){
- return match(PHONE_PATTERN, input);
- }
-
-
- public static boolean isPhoneOrTel(String input){
- System.out.println(PHONE_TEL_PATTERN);
- return match(PHONE_TEL_PATTERN, input);
- }
-
-
- public static boolean isPhoneCallNum(String str) {
- return match(PHONE_CALL_PATTERN, str);
- }
-
-
- public static boolean isChinaTelecomPhoneNum(String str) {
- return match(CHINA_TELECOM_PATTERN, str);
- }
-
-
- public static boolean isChinaUnicomPhoneNum(String str) {
- return match(CHINA_UNICOM_PATTERN, str);
- }
-
-
- public static boolean isChinaMobilePhoneNum(String str) {
- return match(CHINA_MOBILE_PATTERN,str);
- }
-
-
-
-
-
- private static boolean match(String regex, String input) {
- return Pattern.matches(regex, input);
- }
-
-
-
- }
火线速递:山川在我脚下,大地在我怀中;我就是这原野山川之主,我就是这天地万物之灵