Regular Expressions 101

Community Patterns

Password validation

1

Regular Expression
PCRE (PHP <7.3)

/
^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[\w!@#$%]{6,}$
/
gm

Description

Check if the string has a minimum of 6 characters, at least 1 upper case char, at least 1 lower case char and at least 1 number with no spaces.

Submitted by Webchef.de - 9 years ago