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

403
Vistas
How do I implement a negative look-behind regular expression without using `(?<!)`?

I know about the negative look behind (?<!) operator, but it appears that the Javascript engine used in Expo/React-Native does not support it. What I want is to implement the following

export function processEmbedded(text: string): string {
  return text.replace(/(?<!!)\[Embedded\]/gm, "![Embedded]");
}

What I did was a bit hacky in that I stripped and re-added.

export function processEmbedded(text: string): string {
  return text
    .replace(/!\[Embedded\]/gm, "[Embedded]")
    .replace(/\[Embedded\]/gm, "![Embedded]");
}

For my cases it does work, but I am pretty sure there's an edge case where it does not.

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

0

You may use this work-around solution using a capture group:

export function processEmbedded(text: string): string {
  return text.replace(/(^|[^!])\[Embedded\]/gm, "$1![Embedded]");
}

RegEx Demo

(^|[^!]) matches start of line or a character that is not ! in first capture group. In the replacement we put it back using $1 back-reference.

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