用于强密码验证的 PHP 正则表达式
2022-08-30 22:30:15
我在网络上看到了以下正则表达式。
(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
仅当字符串:
* contain at least (1) upper case letter
* contain at least (1) lower case letter
* contain at least (1) number or special character
* contain at least (8) characters in length
我想知道如何转换这个正则表达式,以便它检查字符串
* contain at least (2) upper case letter
* contain at least (2) lower case letter
* contain at least (2) digits
* contain at least (2) special character
* contain at least (8) characters in length
好吧,如果它包含至少2个上限,下部,数字和特殊字符,那么我就不需要8个字符的长度。
特殊字符包括:
'~!@#$%^&*()_-+=[]\|{};:'".,/<>?