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

219
Vistas
Javascript put a variable into a regex?

I have a text from a message in a varaible:

const text =
        "I don't know @Dondes but it did.  It's the highest scoring game in history.";  

I have a regex to check the mention of a name: let regex ="\@\Dondes\b"

I would put the name to check into a variable and use it in the regex like this:

let test = "Dondes";
const userName = `\@\${test}}\b`;  

And after that keep the name like that:

text.match(userName)

But it didn't work ^^ How can I do that?

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