Complex password validation

By | July 20, 2017

Complex password validation

Our team had to build a  regular expression for a client to password validation and it had the following requirements. Below is the expression for anyone that needs anything like this. Hopefully I safe someone some time.

^(?=.{16,})(?=.*[1-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[(!@#$%^&*()_+|~\- =\`{}[\]:”;'<>?,.\/, )])(?!.*(.)\1).+$

  • Length 16 characters
  • At least one number
  • At least one lowercase character
  • At least one uppercase character
  • At least one special character from the following set “(!@#$%^&*()_+|~\- =\`{}[\]:”;'<>?,.\/, )]”
  • No sequential repeating characters

Must say regular expressions are the devils work, no mere-mortal can look at it and comprehend.

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of