Java正则表达式判断手机号码【2014版】

前端技术 · 2016-05-05 · 1925 人浏览

截止2014年9月前已开放和未开放的号码段如下图所示:

Java正则表达式判断手机号码【2014版】

那么相对应的判断手机号码的正则表达式如下:

public static boolean isMobilePhone(String phone){

Pattern pattern = Pattern.compile("^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[6-8])|(18[0-9]))\\d{8}$");

Matcher matcher = pattern.matcher(phone);

return matcher.matches();

}

转自:http://blog.csdn.net/diyangxia/article/details/39494299

java 正则
Theme Jasmine by Kent Liao