Here you can find the source of matchPwd(String pwd)
public static boolean matchPwd(String pwd)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean matchPwd(String pwd) { // if (pwd.length() <8 || pwd.length() >16) { // return false; // }/*from w ww . j av a 2 s . c o m*/ String str = "^(?![^a-zA-Z]+$)(?!\\D+$).{6,16}$"; Pattern p = Pattern.compile(str); Matcher m = p.matcher(pwd); return m.matches(); } }