Regex is definitely not the best tool for that, but if you want regex, and your code is well indented, you can try with:
^(?\s*)(?\w+)\s(?\w+)?\s*(?\w+)?\s*(?\b\w+)\s(?\w+)\((?.*?)\)\s*\{(?.+?)^\k\}
DEMO
It has additional named groups, you can delete them. It use a indentation level to find last }
.