Regex for strong password validation in JavaScript

This pattern uses lookaheads to require at least one lowercase, one uppercase, one digit, and one special character across 8+ characters. Test candidate passwords live below.

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

Try it live

The pattern and sample strings below are pre-loaded. Edit anything, or describe a variation in plain English and generate your own.

Save your patterns across devices.
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/valid ✓

One sample per line. Tested live on the JavaScript engine — other flavors are validated and flagged for differences, not executed.

No samples.

Related regex recipes