Regular Expressions 101

Community Patterns

Password stronger

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*\W).{8,}$
/
gm

Description

This regex will validate your password

To be stronger, the password must be contain:

  • At least 8 characters
  • At least 1 number
  • At least 1 lowercase character (a-z)
  • At least 1 uppercase character (A-Z)
  • At least 1 special character (! @ # $)

I hope I've helped :)

Submitted by Rafael Paciência - 2 years ago