核心提示:2017年8月,工信部给三大运营商批准了新号段,中国电信获得199号段,中国移动得到198号段,中国联通得到166号段。/** * 正则:手机号(精确) * 移动:134(0-8)、135、136、1...
2017年8月,工信部给三大运营商批准了新号段,中国电信获得199号段,中国移动得到198号段,中国联通得到166号段。
/** * 正则:手机号(精确) *
移动:134(0-8)、135、136、137、138、139、147、150、151、152、157、158、159、178、182、183、184、187、188、198
*联通:130、131、132、145、155、156、175、176、185、186、166
*电信:133、153、173、177、180、181、189、199
*全球星:1349
*虚拟运营商:170
*/ public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";/** * 验证手机号(精确) * * @param input 待验证文本 * @return {@code true}: 匹配 {@code false}: 不匹配 */ public static boolean isMobileExact(CharSequence input) { return isMatch(REGEX_MOBILE_EXACT, input); }
private static boolean isMatch(String regex, CharSequence input) { return input != null && input.length() > 0 && Pattern.matches(regex, input); }