Regular Expressions 101

Community Patterns

Password Validator v1.0

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?x) # Matches 10 characters or more, needs capitals & lowercase alphabetical characters, numbers and punctuation repersented ^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\!-\/\:-\@\[-\`\{-\~])(?:.{10,})$ # Could have used [[:punct:]] for puntuation but regex engine may not support # https://geekalicious.blog for mOAR!
/
gm

Description

Validates a passwords based on the following rules:

  • x10 characters or more
  • x1 Lowercase / Uppercase characters needs to be found once
  • x1 numeric needed
  • x1 punctuation character needed
Submitted by anonymous - 3 years ago (Last modified 3 years ago)