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

90
Vistas
I am trying to create a regular expression that would search for letters that repeat in a string

E.g. "asdoekrikkm", i want a regex that will match the "k" because it repeats in the string. I am trying to use string.match(regex) to do that, but i am not sure how to structure the regex.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use a capture group and a back reference:

const match = "asdoekrikkm".match(/(.)\1/)[1];
console.log(match);

(.) finds any character and stores it in a capture group. \1 is a back reference to the first character. (.)\1 searches for two same consecutive characters. .match returns an array with the full match (both consecutive characters) and the the capture group. "asdoekrikkm".match(/(.)\1/)[0] is the full match (two characters) and "asdoekrikkm".match(/(.)\1/)[1] is the capture group (one character).

about 4 years ago · Juan Pablo Isaza 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