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

351
Visualizações
Regex, match paragraph between flags without rowbreaks

I'm trying to pick out sub-strings marked up between flags (using % as flags). It should also avoid sections marked up between another flag (using & for the second flag).

&Label 1&%A lot of text goes in here, but this is the part I want to pick out as a match, it needs to include characters such as __**underline and asterisk**__ and also be able to handle \n line breaks.%&Label 2&%This would become the second match. We also want to include symbols such as 🍗 and other emotes.%

I want this to result in two matches:

  1. A lot of text goes in here, but this is the part I want to pick out as a match, it needs to include characters such as __**underline and asterisk**__ and also be able to handle \n line breaks.
  2. This would become the second match. We also want to include symbols such as 🍗 and other emotes.

I've tried:

/(?<=%)[^&].*?(?=%)/g <- Works on https://regex101.com/ but not in my own java script

    getFieldLabels: function(text){
        let regexp = /(?<=&)[a-zA-Z\s]*(?=&)/g;
        let array = [...text.matchAll(regexp)];
        return array;
    },

/(%(.*)\%)/g <- Requires a rowbreak in the string to work

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