EasyRegex Logo
EasyRegex
Nuevo

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

Javascript

Expresión Regular

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{3,}$
Copiar
¿Tienes Comentarios?

Explicación

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

Ejemplo de Uso

const usernameRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{3,}$/;
const username = 'Us3rname123';
if(usernameRegex.test(username)) {
    console.log('Valid username');
} else {
    console.log('Invalid username');
}
Copiar
Prueba la expresión

Expresiones Regulares Similares