Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\!-\/\:-\@\[-\`\{-\~])(?:.{8})$
/
gm

Description

  • 8 characters long
  • Must include capital letters
  • Must include small letters
  • Must include numbers
  • Must include special characters
  • NOTE: Can also use [[:punct:]] for special characters but it may not be supported by your regex engine.
Submitted by anonymous - 3 years ago (Last modified 3 years ago)