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 Pattern | Name / Component | Function & Rule |
|---|---|---|
| ^ | Start | Starts at string beginning. |
| (?=.*[a-z]) | Lowercase Lookahead | Requires at least one lowercase character. |
| (?=.*[A-Z]) | Uppercase Lookahead | Requires at least one uppercase character. |
| (?=.*\d) | Digit Lookahead | Requires at least one number. |
| (?=.*[@$!%*?&#]) | Symbol Lookahead | Requires at least one special symbol. |
| [A-Za-z\d@$!%*?&#]{8,} | Length & Allowed Set | Matches allowed character set with minimum 8 length. |
| $ | End | Ends at string finish. |
Frequently Asked Questions
Can I increase the minimum length to 12?
Related Regular Expressions
Browse All 40 PatternsAuthentication & Security
Email Address Validation
Standard, robust regular expression to validate email addresses including alphanumeric characters, dots, plus signs, and modern TLDs.
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/Test regex
Authentication & Security
JSON Web Token (JWT)
Validates standard 3-part JSON Web Tokens (Header.Payload.Signature) in Base64URL encoding.
/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/Test regex
Authentication & Security
Alphanumeric Username
Standard web application username policy: 3 to 20 characters, starting with a letter, allowing underscores.
/^[a-zA-Z][a-zA-Z0-9_]{2,19}$/Test regex