Regex for checking that at least 3 of 4 different character groups exist

后端 未结 6 670
一个人的身影
一个人的身影 2020-12-01 13:04

I\'m trying to write a password validator.

How can I see if my supplied string contains at least 3 different character groups?

It\'s easy enough to check if

6条回答
  •  误落风尘
    2020-12-01 13:25

    This will do all that in one regex

    ^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W])(?=.*[!@#\$%&/=?_\.,:;-\\]).*$

提交回复
热议问题