正则表达式
密码验证:
/** * 验证密码 * @param password * @return */ public static boolean isPassword(String password) { String rex = "^([0-9a-zA-Z\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\_]){6,16}$"; Pattern p = Pattern.compile(rex); Matcher m = p.matcher(password); return m.matches(); }
姓名:
String rex = "^[\u4e00-\u9fa5]{2,4}$"; //姓名