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

102
Vistas
Converting a RegExp constructor to be Safari-compatible

I have this regexp constructed pattern I'm passing a string variable to. This works perfectly in Chrome, but won't work in Safari.

Is there a way I might be able to convert this code to be compatible across browsers? Thank you!

(e = e
  .split(new RegExp("(?<!\\w)" + t[l] + "(?!\\w)(?![^\\[\\]]*\\])", "gm"))
  .join(n)),
  1 == caseinsensitive &&
    (e = e.replace(
      new RegExp("(?<!\\w)" + t[l] + "(?!\\w)(?![^\\[\\]]*\\])", "gmi"),
      "[$&](" + n + ")"
    ));
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use

(e = e
  .split(new RegExp("(?!\\B\\w)" + t[l] + "(?!\\w)(?![^\\][]*])", "g"))
  .join(n)),
  1 == caseinsensitive &&
    (e = e.replace(
      new RegExp("(?!\\B\\w)" + t[l] + "(?!\\w)(?![^\\][]*])", "gi"),
      "[$&](" + n + ")"
    ));

The (?!\B\w) negative lookahead requires a word boundary position if the next char is a word char. Else, if the next char is not a word char, no word boundary is required.

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