Can someone suggest a regular expression for validating a password with the following conditions.
- Password must be at least 12 characters long
- Password must not begin with a number
- Password must have 3 out of the following 4 characteristics:
- At least one upper case letter (A-Z)
- At least one lower case letter (a-z)
- At least one number (0-9)
- At least one of the following symbols:
hyphen ( – ), underscore ( _ ), dollar ( $ ), pound/hash ( # )
I’m using vbscript and classic ASP.
Thanks in advance,
m0dest0
When all you have is a hammer eh?
Seriously though, using a regex is not really the correct answer here. If you’re dead set on using regexes, then at least break it up into multiple cases and evaluate each individually.
If it were me, I’d just write a set of simple functions that check each case. Eg: one for upper/lower case, one for number, one for special symbols, then a main routine that checks that all your requirements are met. As FailedDev mentioned above, a single regex to handle all these cases would be a pain to both write AND maintain..