I have the following snippet where I would like to extract code between the {foreach} and {/foreach} using a regular expression:
{foreach (...)}
Some random HTML content <div class="">aklakdls</div> and some {$/r/template} markup inside.
{/foreach}
I already have:
{foreach [^}]*}
but I am unable to match anything after that. Is there any way to match anything BUT {/foreach} as a whole token? Please note that the content between {foreach}{/foreach} can also contain "{$" tokens.
(BaileyP && Tomalak)'s answers are correct, but I have choosen BaileyP's answer for simplicity sake.