正则表达式

密码验证:

    /**
	 * 验证密码
	 * @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}$";   //姓名

 

  

posted @ 2017-03-07 11:01  wanhua.wu  阅读(91)  评论(0编辑  收藏  举报