Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

342
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!