パスワードの条件は、8 文字以上、特殊文字 1 文字以上、数字 1 文字以上
このために、検証する単純なクラスを作成しましたが、最終的に失敗します。
どんな助けでも大歓迎です。
public class PasswordVerifier {
private static final String SPECIAL_CHARACTERS = "(`~!@#$%^&*()_+=-][;'/.,\\<>?|:\"}{)";
public static void main(String... args) {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
String password = in.readLine();
if(!password.matches("^.*(?=.{8,})(?=.*[0-9])(?=.*[SPECIAL_CHARACTERS]).*$")){
System.out.println("Password does not satisfy compliant");
} else {
System.out.println("Yes.. gets through");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}