标签:手机号码 地址 表达式 logs 正则 strong class import log
1.验证邮箱地址是否正确:String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
import java.util.regex.Matcher;//jar包 import java.util.regex.Pattern;//jar包 public static boolean checkEmail(String email) { boolean flag = false; try
{ String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; Pattern regex = Pattern.compile(check); Matcher matcher = regex.matcher(email); flag = matcher.matches(); } catch (Exception e) { flag = false; } return flag; }
}
2.验证手机号码:String check="^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"
标签:手机号码 地址 表达式 logs 正则 strong class import log
原文地址:http://www.cnblogs.com/zhabayi/p/6623604.html