I have this regex which looks for %{any charactering including new lines}%
:
/[%][{]\s*((.|\n|\r)*)\s*[}][%]/gm
If I test the regex on a string like "%{hey}%", the regex returns "hey" as a match.
However, if I give it "%{hey}%%{there}%", it doesn't match both "hey" and "there" seperately, it has one match—"hey}%%{there".
How do I make it ungreedy to so it returns a match for each %{}%?
Add a question mark after the star.
/[%][{]\s*((.|\n|\r)*?)\s*[}][%]/gm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With