Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
((?=.*\d)(?=.*[a-z])(?=.*[A-Z])|(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%\^&\*\_\-+=\?|\/\(\)\\{}\[\]:<>,\.;])|(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\_\-+=\?|\/\(\)\\{}\[\]:<>,\.;]))(?=\S+$).{15,}
/
gm

Description

  • A password must consist of at least fifteen characters.
  • A password must contain a character from at least three of the following four sets:
    • A-Z
    • a-z
    • 0-9
    • !@#$%^&*_-+=?|/(){}[]:<>,.;
  • No whitespaces
Submitted by RGT, Mast - 3 years ago