EasyRegex Logo
EasyRegex
Nouveau

Validate Username with Uppercase, Lowercase, and Number in Any Order

Javascript

Expression Régulière

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{3,}$
Copier
Avez-vous des Retours ?

Explication

This regex pattern uses positive lookaheads to ensure that the string contains at least one lowercase letter, one uppercase letter, and one digit. The order of these characters in the string does not matter. The pattern also enforces a minimum length of 3 characters.

Javascript

Exemple d'Utilisation

const usernameRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{3,}$/;
const username = 'Us3rname123';
if(usernameRegex.test(username)) {
    console.log('Valid username');
} else {
    console.log('Invalid username');
}
Copier
Testez l'expression

Expressions Régulières Similaires