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

348
Vistas
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 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