Input password regular strength judgment

According to the different strengths of the business, the difficulty of judging the conditions is different, or the product dog ------ (manual funny)

Pure numbers [0-9] 

Lowercase letter [az] 

Uppercase letter [AZ] 

Mobile phone input method special symbols, [\"`~!@#$%^&*()_\\-+=<>?:\\\"{}|,./;'\\[\\]· ~! @#¥%……&*()——+={}|《》? : ""【】,;'',. ,] is not complete, you can add it yourself)

 //输入的纯数字为弱
        if (str.matches("^[0-9]{1,32}")) {
            return 1;
        }
  //输入的纯小写字母为弱
        else if (str.matches("^[a-z]{1,32}")) {
            return 1;
        }
 //输入的大写字母和字符,输入的字符密码为二级
        else if (str.matches("^[A-Z\"`~!@#$%^&*()_\\-+=<>?:\\\"{}|,./;'\\[\\]·~!@#¥%……&*()——+={}|《》?:“”【】、;‘',。、]{1,32}")) {
            return 2;
        }
if (str.matches("^[A-Z\"`~!@#$%^&*()_\\-+=<>?:\\\"{}|,./;'\\[\\]·~!@#¥%……&*()——+={}|《》?:“”【】、;‘',。、a-z0-9]{1,32}")) {
            return 4;
        }

I wrote a few conditions casually. The main thing is to look at the regularity.

Guess you like

Origin blog.csdn.net/qq_36767261/article/details/108801292