Let's that we are looking for a function body of foo inside a string or file. Capturing the signature is easy.
However is there a regex expression that would capture the body of a function. We do not make any assumptions about the internal structure of the function.
It could be something flat like:
int foo()
{
return i;
}
Or something layered like this:
void foo()
{
if(true)
{
for (int i=0; i<5; i++ )
{
cout<< i << std::endl;
}
}
}
So is there a way to do it?