Working on a project where it requires me to have a password field using pattern attribute. Not really done a lot of regex stuff and was wondering whether someone could help out.
The requirements for the field are as follows:
- Can't contain the word "password"
- Must be 8-12 in length
- Must have 1 upper case
- Must have 1 lower case
- Must have 1 digit
Now, so far I have the following:
[^(password)].(?=.*[0-9])?=.*[a-zA-Z]).{8,12}
This doesn't work. We can get it so everything else works, apart from the password string being matched.
Thanks in advance, Andy
EDIT: the method we've used now (nested in comments below) is:
^(?!.*(P|p)(A|a)(S|s)(S|s)(W|w)(O|o)(R|r)(D|d)).(?=.*\d)(?=.*[a-zA-Z]).{8,12}$
Thanks for the help