Skip to main content
CalcHive

Regex for Strong Password

Validates strong passwords: minimum 8 characters, at least one uppercase, one lowercase, one digit, and one special character.

Pattern

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

Pattern Breakdown

TokenExplanation
^Start of string
(?=.*[a-z])Lookahead: at least one lowercase letter
(?=.*[A-Z])Lookahead: at least one uppercase letter
(?=.*\d)Lookahead: at least one digit
(?=.*[@$!%*?&])Lookahead: at least one special character
[A-Za-z\d@$!%*?&]{8,}8 or more allowed characters
$End of string

Test Examples

InputMatch?
MyP@ssw0rdMatch
Str0ng!PassMatch
weakpassNo match
NoSpecial1No match
Short1!No match

Common Use Cases

  • Password creation validation
  • Security policy enforcement
  • Account registration

Variations

^.{8,}$

Minimum 8 characters only (no complexity)

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

Without special character requirement

Want to test this pattern with your own data?

Open the Regex Tester