Skip to main content
Regexflux

Medium Strength Password

beginner

Validates passwords with at least 6 characters, one letter and one digit.

passwordvalidationsecurity

Pattern

/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/

Try It

0 of 7 strings matched

Explanation

Uses two positive lookaheads to require at least one letter and one digit. Matches 6 or more alphanumeric characters from start to end.

Test Strings

Matching

  • abc123
  • Test99
  • hello1world2

Non-matching

  • abcdef
  • 123456
  • ab1
  • !!!!!!

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GONot supported (RE2 engine)

Code Snippets

const regex = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Related Patterns