最近发现各大手机运营商又增加了新的号码段,在项目中的判断手机号码的正则表达不能用了,自己搜集了一下,新写了一个正则表达式,希望有帮助。

 

  • 匹配手机号码的正则表达式:
    ^((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}$

---------------------
本文来自 超侠 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/github_36344730/article/details/79757676?utm_source=copy

/**
* 判断是否是手机号
* 
* @param mobile
* @return
*/
public static boolean isMobile(String mobile) {
    String regex = "^((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}$";
    Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
    Matcher m = p.matcher(mobile);
    return m.matches();
}

 

posted on 2018-10-04 08:51  qqhfeng16  阅读(776)  评论(0编辑  收藏  举报