Adding a Regex101 URL: https://regex101.com/r/7Pd1ri/1/
I'm been working on this problem for about 3 and a half hours.
I can't for the life of me figure out what I'm doing wrong. I'm so close to making it work perfectly but I don't know how to check for the first occurrence of {/IF}
My REGEX:
{IF\s*([^}]+)}([\s\S]+)(?:{\/ELSE})([\s\S]+){\/IF}
The file being parsed:
{IF !isLoggedIn}
<a href="/sign-in/">Sign In</a>
{ELSE}
Welcome back, {>username}!<br />
{# students}
<li>{#>last_name}, {#>first_name}</li>
{/#}
{/IF}
{IF isLoggedIn}
Beta Testing...
{/IF}
For some reason, the regex captures all the way to the second {/IF}
as the body of the ELSE