Regexp

Hello,

Please consider the following input:



foo (*anothervalue) {
  anothervalue:  *anothervalue;
}

test (*value, *othervalue) {
  value = *value;
  othervalue = *othervalue;
}

My current regexp catches only the first function. As soon as a function has more than one line within its brackets, my pattern fails to catch it.


preg_match_all("/.*\\(.*\\)\\s*\\{\\s*.*\\s*\\}/",$source, $functions);
$declarations = $declarations[0];

Could someone correct/improve my regexp?

:tup:

regards,

-jj. :slight_smile:

I believe this is the same question as recently asked in this thread. Let’s close this one and see if you can find the answer in that thread, or spur discussion in that thread to find an answer that works for you.