in reply to assertions help

The following can usually be used to skip over a section that doesn't contain something that matches PATTERN:
(?(?!PATTERN).)*
Sounds like you want
(?(?!^#\s*else\b).)*
Have you considered
#ifdef X ...a... # ifdef Y ...b... # else ...c... # endif ...d... #else ...e... # ifdef Y ...f... # else ...g... # endif ...h... #endif