I'm using ruby. I'm looking to match the outer "if" group of this:
{#if x > 10}
<p>{x} is greater than 10</p>
{#if 5 > x}
<p>{x} is less than 5</p>
{/if}
{/if}
What I have so far is this regex:
\{#if(.*)}(.|\n)*?\{\/if\}
But that just matches the first /if statement instead of the last one (see https://rubular.com/r/4l89GlANV9AVCQ). Any ideas?
(I tried this recursive regex matcher I saw on Stack Overflow: https://rubular.com/r/7a4PYTtxFQftob, but I'm struggling to make it work for the above)