I've managed to find out and adapt a regular expression to validate password
fields with custom rules.
With the regexp ^(?=(.*\d){2,})(?=(.*[a-zA-Z]){3,}).{8,}$ you can ensure the
password is 8 chars long and contains at least 2 digits and 3 alphas.
Here follows the regexp explanation:
1. the (?= part means match but don't consume so i can verify without having
any further counter effects;
2. the (.*\d) and (.*[a-zA-Z]) parts mean any digit and any alpha
respectively;
3. the {2,} and {3,} parts mean at least two and at least three chars;
4. the final {8,} part means at least 8 chars and because it's not inside
any (?= grouping the result will consume the entire password;
5. the additional . (dot) inside the (?= grouping is used to allow any
interfering character to happen in between.
May be this regular expression can be included into the standard auth module
to provide a front-end validation.
--
View this message in context: http://www.nabble.com/Password-validation-tf3185918s17546.html#a8842555
Sent from the SmartWeb Users mailing list archive at Nabble.com.
|