Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
How does a regex match the format like xxxx1111 in js?

I'm limiting the user to input a string contains four letters following with 4 digit of numbers, like the format qwer1234 in vue.js. I have tried the regex b[a-z]{4}+[0-9]{4}\b but it seems not working. Are there any mistake I make?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

4 lowercase characters would be:

  • [a-z]{4}

4 digits would be

  • \d{4}

a word boundary is

  • \b

the start or end of a line are marked like this:

  • ^...$

So, if this phrase should be contained (possibly only as a part) of a bigger phrase, put word boundaries around it.

  • \b[a-z]{4}\d{4}\b

or if the entire phrase has to match exactly, then you can put it between start and end characters.

  • ^[a-z]{4}\d{4}$
over 4 years ago · Santiago Trujillo Denunciar

0

I deleted the '+', and it works!

var pattern = /\b[a-z]{4}[0-9]{4}\b/;
var str = "";
console.log(pattern.test(str));
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda