Regular Expressions 101

Password validation

Open Workspace
  • JavaScript
  • Match
0

Regular Expression

/
^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[^\w\s]).{8,}$
/

Description

Regex used for password validation. A password match the following:

  • At least 8 characters in length
  • Minimum of 1 lower-case character
  • Minimum of 1 upper-case character
  • Minimum of 1 digit
  • Minimum of 1 special character (non-whitespace)
Submitted by Sjoerd de Vries