Hello,
I'm looking for the shortest, cleverest possible solution to this. When
changing a password, I need a RegExp which will ensure the following
criteria :
1. It must be at least 6 characters
2. It must contain at least one lower case letter [a-z]
3. It must contain at least one upper case letter [A-Z]
4. It must contain at least one number [0-9]
5. Optionally, it can cover for accepted non-alphanumeric chars such as
"_", "-" etc (but not "#"), and a maximum password length of 14
characters
Before you dive in - the non-ordering of this is important.
E.G :
$password =~ /^[a-zA-Z0-9]\w{6,14}$/ ;
would not work, as any instance of the range will be incorrectly
accepted as valid.
Similarly :
$password =~ /^[a-z][A-Z][0-9]\w{6,14}$/ ;
would also not work as it forces the password change to be
lowercase-uppercase-numeric.
I know there are many different ways of doing this *without* a RegExp -
I already have that, so I'd be grateful for any and all suggestions !
Regards,
Matt.