Regular Expressions 101

Community Patterns

Strict Password Validator

29

Regular Expression
ECMAScript (JavaScript)

/
^(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[^\w\d\s:])([^\s]){8,16}$
/
gm

Description

This regex matches only when all the following are true:

password must contain 1 number (0-9) password must contain 1 uppercase letters password must contain 1 lowercase letters password must contain 1 non-alpha numeric number password is 8-16 characters with no space

Submitted by qho - 6 years ago (Last modified 8 months ago)