Regex answer

Standard

The answer to the little puzzle I posted on Friday is now sort of lost – as I updated the regex I was using to handle a full IF ... THEN ... ELSE clause.

But that one is…(at least this is what works for me)

IF\s((.(?!THEN))+)\sTHEN\s((.(?!ELSE))+)?!(\sELSE(.+))IF\s((.(?!THEN))+)\sTHEN\s((.(?!ELSE))+)\sELSE(.+)