jinpengyong
2023-09-28 0972f16bb4354539f782d9f91db83bd9f3b87471
screen-common/src/main/java/com/moral/util/RegexUtils.java
@@ -21,11 +21,11 @@
    /**
     * 验证密码
     *
     * @param password 密码只能包含 字母 , 下划线 , 数字,长度必须在3 到 20 之间
     * @param password 密码只能包含 字母 , 下划线 , 数字,长度必须在6 到 20 之间
     * @return 证成功返回true,验证失败返回false
     */
    public static boolean checkPassword(String password) {
        String regex = "[0-9a-zA-Z_]\\w{2,19}";
        String regex = "[0-9a-zA-Z_]\\w{5,19}";
        return password.matches(regex);
    }
@@ -195,4 +195,17 @@
        return Pattern.matches(regex, ipAddress);
    }
    /**
    * @Description: 判断字符串是否包含中文
            * @Param: [str]
            * @return: boolean
            * @Author: 陈凯裕
            * @Date: 2021/4/21
            */
    public static boolean checkContainChinese(String str){
        Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
        Matcher matcher = p.matcher(str);
        return matcher.find();
    }
}