сряда, 11 юни 2008 г.

Password validation regex

1: the password must be at least 8 characters long and start and end with a letter.

^[A-Za-z]\w{6,}[A-Za-z]$

2: the password length doesn’t matter, but the password must contain at least 1 number, at least 1 lower case letter, and at least 1 upper case letter.

^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$

3: Must be at least 10 characters,must contain at least one one lower case letter, one upper case letter, one digit and one special character, valid special characters are - @#$%^&+=

^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$

source: http://nilangshah.wordpress.com/2007/06/26/password-validation-via-regular-expression/