I'm trying to figure out a problem I'm having with regex.
I'm using this regex with preg_match_all on a large multi line string:
/(\{(if|while|function|loop|\$|#)(.+)\})/
It currently works to match all text that starts with { and ends with } such as {$test} or {$function="test()"}
However, if one line in the string contains two matching blocks, the regex returns the whole line such as:
{$value.url}" class="link">{$value.title}
I can't figure out how to make the regex not do a 'greedy' match with (.+). The reason why I have (.+) is because there could be any character/number/underscore/period/quote/space in between the two brackets {}.
Can someone help me out?
{if {$fish} do }