php regex for strong password validation
- by Jason
Hello,
I've seen around the web the following regex
(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
which validates only if the string:
* 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
I'd like to know how to convert this regex so that it checks the string to
* 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
well if it contains at least 2 upper,lower,digits and special chars then I wouldn't
need the 8 characters length.
special characters include:
`~!@#$%^&*()_-+=[]\|{};:'".,/<?
thanks in advance.