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

243
Vistas
Passing a variable to javascript regex

I'm trying to pass a variable to my javascript regular expression, but it returns null all the time. Regular expression is correct, but, Im unable to execute it on the JS. Below is my code:


'use strict';

  function matchExp(val) {
    let text = 'Is this " all": there is?';
    var match_pat = '[^"]* all\b[^"]*("\s*:)'
    var regMatch = new RegExp(match_pat, 'g');
    return(text.match(regMatch))
  }

  console.log(matchExp())
  module.exports = {
    matchExp
  }
**Expected Result**: "all":
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