RegEx question for password strength validation -


i'm looking single regular expression our password requirements. passwords:

  • must @ least 8 characters
  • cannot contain spaces
  • contain both lowercase , uppercase characters
  • contain @ least 1 numeric digit
  • contain @ least 1 special character (i.e. character not 0-9,a-z,a-z)

idea , of work taken http://www.zorched.net/2009/05/08/password-strength-validation-with-regular-expressions/

^\s*(?=\s{8,})(?=\s*[a-z])(?=\s*[a-z])(?=\s*[\d])(?=\s*[\w])\s*$ 

i used basic answer @ bottom of post, replaced dots \s rule out space characters, , moved around of assertions.


Comments