Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

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

Description

The string must contain at least 1 lowercase alphabetical character. The string must contain at least 1 uppercase alphabetical character. The string must contain at least 1 numeric character. The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict. The string must be eight characters or longer

Submitted by amine - 3 years ago