I'm not seeing a precise answer on StackOverflow, or in any of my google results...

I'm trying to write a regex to stuff into a GIT BLAME command. It goes like this:

I know:
- The FILENAME I want to search.
- The FUNCTIONNAME I want to retrieve from that file.

I want GIT BLAME on every line of that function, giving me the email address of every person who worked on every line of that function, from its declaration at the top, down through every line of the function down to its closing curlybrace.

The syntax would be:
GIT BLAME -e -L*RegexToGetFUNCTIONNAME* FILENAME

I have half an example which is based on this blog entry and it goes like this:

Code:
git blame -e -L/^myFunctionNameIamLookingFor/,/^}/ C:\folder\folder\folder\folder\filename.cs


This *works*, but, it has an achilles heel. It stops at the first closing curlybrace it finds. Sometimes that's fine, it returns the entire function and everything is hunky dory. But if the interior of the function contains some curly braces (for instance if there is a loop or an IF statement inside the function), then the regex halts halfway through the function as soon as it hits a closing curlybrace.

I have seen some items on StackOverflow which talk about using regex nesting to get the correct levels within nested braces, but what I'm missing is the glue to get the entire line of the function name itself, everything up to its first curly brace, and then everything up to the final curly brace that closes that particular function.

Regex is still pretty baffling to me, alas. This seems like a pretty advanced use of it.

Anyone good with Regex know how to handle this situation?
_________________________
Tony Fabris