Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda