/**
* @param value
* @return void
* @throws Exception
* @description:校验手机号格式
*/
public boolean checkPhoneFormat(String value) throws Exception {
String regex = "^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$";
int valueLength = 11;
if (value.length() != valueLength) {
return false;
} else {
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(value);
boolean isMatch = m.matches();
if (!isMatch) {
return false;
}
}
return true;
}
手机号校验
最新推荐文章于 2024-06-19 15:02:40 发布