/** |
* |
* TODO 方法作用:邮箱验证 |
* |
* @param email |
* @return |
* @Author: 刘泽中 |
* @Date: 2015-5-8 上午09:55:16 |
*/ |
public static boolean checkEmail(String email) { |
boolean result = false ; |
try { |
Pattern regex = Pattern.compile( "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$" ); |
Matcher matcher = regex.matcher(email); |
result = matcher.matches(); |
} catch (Exception e) { |
result = false ; |
} |
return result; |
} |
/** |
* |
* TODO 方法作用:电话验证 |
* |
* @param mobile |
* @Author: 刘泽中 |
*/ |
public static boolean checkMobileFormat(String mobile) { |
boolean result = false ; |
try { |
String check = "^(((13[0-9])|(15([0-3]|[5-9]))|(17([0-9]))|(18[0,5-9]))\\d{8})$" ; |
Pattern regex = Pattern.compile(check); |
Matcher matcher = regex.matcher(mobile); |
result = matcher.matches(); |
} catch (Exception e) { |
result = false ; |
} |
return result; |
} |