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

178
Vistas
Regex to get 2 characters between other 2 characters and not include specific text in between

I've asked similar question before, yet running into deeper issues that I'm hoping to fix. I'm trying to indentify a specific scenario with Regex.

Link to previously asked question: Previous question and answer

In the example bellow my goal is the remove brackets around second (second can be any other word):

content = [](first-(second))

I've been recommended to use the following method:

content.replace(/(?<=\]\()(.*)(?=\))/g, (x) => x.replace(/[()]/g, '')):

Perfect outcome: [](first-second)

It worked until I ran into another string that looked like this:

content = ([](first-(second)))

Outcome: ([]first-(https)

I think my goal now is to add a condition, that checks if the word is equal to https then don't touch it. If you have a better option to deal with this, I would be glad to hear it.

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