正则表达式对手机号的验证^[1][3-8]+\\d{9}
public static boolean isMobile(String value) {
return value.matches("^[1][3,5]+\\d{9}");
}
中文:
public static boolean isChinese(String value) {
return value.matches("^[\u4e00-\u9fa5]+$");
}
数字;:
public static boolean isNumber(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
小数
public static boolean isFloat(String str) {
return str.matches("[\\d.]+");
}
邮箱:
public static boolean isEmail(String mail) {
String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(mail);
return m.find();
}