Skip to main content
Authentication & Security · In-Browser Regular Expression Lab

Strong Password Regex — Enforce Uppercase, Lowercase, Number & Symbol

Enforces minimum 8 characters, at least one uppercase letter, one lowercase letter, one digit, and one special character.

Flags:
//none
Match Found
Load Sample:
Match Inspection & Details1 match
Match #1:P@ssw0rd2026

Test Samples Verification Matrix

Expected Valid Samples (Should Match)

P@ssw0rd2026 Pass
Secure#Key19 Pass
C@st0vMaster! Pass

Expected Invalid Samples (Must Reject)

password Rejected (Pass)
Password1 Rejected (Pass)
Pass! Rejected (Pass)
short1A! Accepted (Fail)
Code Implementation Generator
// JavaScript / TypeScript (ES6+)
const pattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#])[A-Za-z\d@$!%*?&#]{8,}$/;
const text = "P@ssw0rd2026";

const isMatch = pattern.test(text);
console.log("Is Match:", isMatch);

if (isMatch) {
  const matches = text.match(pattern);
  console.log("Matches:", matches);
}

Regular Expression Token Breakdown

Uses positive lookaheads to enforce password complexity without consuming characters. Each component of the regular expression serves a distinct syntactical purpose as mapped below:

Token PatternName / ComponentFunction & Rule
^StartStarts at string beginning.
(?=.*[a-z])Lowercase LookaheadRequires at least one lowercase character.
(?=.*[A-Z])Uppercase LookaheadRequires at least one uppercase character.
(?=.*\d)Digit LookaheadRequires at least one number.
(?=.*[@$!%*?&#])Symbol LookaheadRequires at least one special symbol.
[A-Za-z\d@$!%*?&#]{8,}Length & Allowed SetMatches allowed character set with minimum 8 length.
$EndEnds at string finish.

Frequently Asked Questions

Can I increase the minimum length to 12?
Yes, change `{8,}` at the end of the pattern to `{12,}`.
Browse All 40 Patterns