zoukankan      html  css  js  c++  java
  • Java 判断密码是否是大小写字母、数字、特殊字符中的至少三种

    public class CheckPassword {
        //数字
        public static final String REG_NUMBER = ".*\d+.*";
        //小写字母
        public static final String REG_UPPERCASE = ".*[A-Z]+.*";
        //大写字母
        public static final String REG_LOWERCASE = ".*[a-z]+.*";
        //特殊符号
        public static final String REG_SYMBOL = ".*[~!@#$%^&*()_+|<>,.?/:;'\[\]{}"]+.*";
     
        public static boolean checkPasswordRule(String password){
            //密码为空或者长度小于8位则返回false
            if (password == null || password.length() <8 ) return false;
            int i = 0;
            if (password.matches(REG_NUMBER)) i++;
            if (password.matches(REG_LOWERCASE))i++;
            if (password.matches(REG_UPPERCASE)) i++;
            if (password.matches(REG_SYMBOL)) i++;
     
            if (i  < 3 )  return false;
     
            return true;
        }
    
  • 相关阅读:
    MySQL too many connections
    【MySQL】 清除等待连接
    wmic 获得系统硬件信息
    Linux 修改用户名
    初步了解虚拟化
    MySQL show 语句
    php去除bom
    jq闭包
    git
    地址收藏
  • 原文地址:https://www.cnblogs.com/JohnDawson/p/11249049.html
Copyright © 2011-2022 走看看