Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(?=.*?[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 - 2 years ago