0

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.

Ami
  • 37
  • 4

0 Answers0