Here is my validate method
public boolean isValidPassword(final String password) {
Pattern pattern;
Matcher matcher;
final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).{8,}$";
pattern = Pattern.compile(PASSWORD_PATTERN);
matcher = pattern.matcher(password);
return matcher.matches();
}
From above code I need to must enter at least 1 digit, 1 lower, 1 upper, 1 special. but i need to give choice to user enter any 3 choices out of 4 .. i.e..... 1 digit, 1 upper, 1 lower (or) 1 special, 1 digit, 1 upper...etc