Validation

Password (No Special Chars)

Validate passwords requiring at least one lowercase, one uppercase, one digit, and minimum 8 characters — no special characters required.

Try it in RegexPro →

Available in

JavaScript / ECMAScript code

jsJavaScript
const re = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d]{8,}$", "");
const input = "Password1";
const match = input.match(re);
console.log(match ? match[0] : null);

Uses `String.prototype.match`, which returns the first match or null.

Pattern

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

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

How it works

Three positive lookaheads (?=.*[a-z]) (?=.*[A-Z]) (?=.*\d) require a lowercase letter, uppercase letter, and digit somewhere in the string. [A-Za-z\d]{8,}$ then matches 8+ alphanumerics. Lookaheads are zero-width so they don't consume — they're constraints, not consumers. Note: Go's RE2 does not support lookaheads, so this pattern won't compile there.

Examples

Input

Password1

Matches

  • Password1

Input

MyPass99

Matches

  • MyPass99

Input

weakpass

No match

—

Common use cases

  • •Lightweight signup form validation
  • •Password reset flows
  • •Internal-tool password rules
  • •Transitional rule when migrating from legacy systems

Related patterns