Wednesday, July 1, 2009

Regex for strong password implementation

Advance password

(?=^.{12,}$)((?=.*\d)(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$

Passwords will contain at least (1) upper case letter
Passwords will contain at least (1) lower case letter
Passwords will contain at least (1) number or special character
Passwords will contain at least (12) characters in length

Basic password

(?=^.{12,}$)((?=.*\d)(?=.*\W+))(?![.\n])(?=.*[a-z]).*$

Passwords will contain at least (1) letter
Passwords will contain at least (1) number or special character
Passwords will contain at least (12) characters in length