Regexes are wonderful things, and a very powerful tool.
But ... they are text processors, not syntactic analysers, not parsers, not tokenizers, not any stage of a compiler.
While it's probably possible to do what you want with one, it's a poor idea because the regex is going to get really complicated, really quickly - and still won't work well under all circumstances. For example, what happens with comments? they can contain anything
- and be anywhere - so your regex will have to cope with them as well. And that means when the else is inside a comment, or a comment is inside the else.
And what happens when someone writes
else if ...
Remove the "empty else" and you change the program logic significantly.
I'm sure there are probably a dozen more "special cases" that your regex may have to cope with, and that's when it gets really nasty and you spend more time fighting bugs in the regex than you do coding it ...
Use a tokenizer, use a parser. Regex is a good hammer, but it's not the only tool in the box, so don't treat every problem as a nail!