//邮箱
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;
}
//0手机,1电话/传真
public static boolean validTPFNum(String checkType,String phoneNum){
boolean flag=false;
Pattern p1 = null;
Pattern p2 = null;
Matcher m = null;
p1 = Pattern.compile("^1[3|5|8|7][0-9]\\d{8}$");
p2 = Pattern.compile("^0\\d{2,3}[\\-]\\d{7,8}([\\-]?|-\\d{0,5})$");
if("0".equals(checkType)){
if(phoneNum.length()!=11){
return false;
}else{
m = p1.matcher(phoneNum);
flag = m.matches();
}
}else if("1".equals(checkType)){
m = p2.matcher(phoneNum);
flag = m.matches();
}
return flag;
}
//联系人
public static boolean checkLinkMan(String linkMan){
if(linkMan.length()>2 && linkMan.length()<5){
return false;
}
Pattern p=Pattern.compile("^[\u4E00-\u9FFF]+$");
Matcher m=p.matcher(linkMan);
return m.matches();
}