package com.ag.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PwdCheckUtil {
    public static void main(String[] args) {
        String str = "123@A";
        System.out.println(PwdCheckUtil.isContainsNum(str));
        System.out.println(PwdCheckUtil.isContainsUppChar(str));
        System.out.println(PwdCheckUtil.isContainsLowChar(str));
        System.out.println(PwdCheckUtil.isContainsSpeChar(str));
    }

    public static boolean isContainsNum(String pwd){
        Pattern compile = Pattern.compile(".*[0-9].*");
        Matcher matcher = compile.matcher(pwd);
        return matcher.matches();
    }

    public static boolean isContainsUppChar(String pwd){
        Pattern compile = Pattern.compile(".*[A-Z].*");
        Matcher matcher = compile.matcher(pwd);
        return matcher.matches();
    }

    public static boolean isContainsLowChar(String pwd){
        Pattern compile = Pattern.compile(".*[a-z].*");
        Matcher matcher = compile.matcher(pwd);
        return matcher.matches();
    }

    public static boolean isContainsSpeChar(String pwd){
        Pattern compile = Pattern.compile(".*[ _`~!@#$%^&*()+=|{}:;,.<>/?].*");
        Matcher matcher = compile.matcher(pwd);
        return matcher.matches();
    }
}
