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

101
Views
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
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!