Below is the code snippet for Validation of the strong password.
public void passwordChecker(String password) {
boolean flag = true;
//Check for minimum 8 character
if(password.length() < 8){
flag = false;
}
//check for at least on Alphanumeric (including combination of Capital and Small letters) characters
flag = password.matches(".*[A-Z].*") && password.matches(".*[a-z].*") && password.matches(".*[1-9].*");
System.out.println(flag);
if(flag){
//Check for at least one Special Characters
flag = password.matches(".*[!@#$%^&*|_+-].*");
System.out.println(flag);
}
//System.out.println(flag);
System.out.println("test : " + flag);
}
Check out and share feedback....
public void passwordChecker(String password) {
boolean flag = true;
//Check for minimum 8 character
if(password.length() < 8){
flag = false;
}
//check for at least on Alphanumeric (including combination of Capital and Small letters) characters
flag = password.matches(".*[A-Z].*") && password.matches(".*[a-z].*") && password.matches(".*[1-9].*");
System.out.println(flag);
if(flag){
//Check for at least one Special Characters
flag = password.matches(".*[!@#$%^&*|_+-].*");
System.out.println(flag);
}
//System.out.println(flag);
System.out.println("test : " + flag);
}
Check out and share feedback....