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

100
Visualizações
How to get anything between brackets in a multiline string with javascript and regex

Supposing I have a string with multiple lines and I want to get everything that is enclosed in square brackets. It's possible?

Just like this:

string:

[[start]]
hello world
[[end]]

[[start]]
lorem ipsum
[[end]]

And I want to reach "hello world" and "lorem ipsum".

My start point is:

.*(?=\[{2}end\]{2})

With this I can get anything until [[end]] (but unfortunatelly includes [[start]]. And just if the string is in the same line. Like this:

[[start]]lorem ipsum[[end]]

Regex is really hard to understand for me.

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