I'm editing a PHP file to replace a function's code by another code provided. My problem is that the function's code may change. So, I don't know exactly how I should do the regex to find it.
Here's an example:
function lol()
{
echo('omg');
$num=0;
while($num<100)
{
echo('ok');
}
}
function teste()
{
echo('ola');
while($num<100)
{
echo('ok');
}
}
function test()
{
echo('oi');
while($num<100)
{
echo('ok');
}
}
What I need is to get the code of function teste(), which would be:
echo('ola');
while($num<100)
{
echo('ok');
}
BUT: I do not know how many whiles, foreaches or how many brackets are inside the functions, neither I don't know it's order. The example was just an example.
How would I be able to get the function's code? Thank you in advance.