I am getting some problems while trying to use this regex:
(public +function|private +function|function) +([a-zA-Z_$][0-9a-zA-Z_$]*) *\\(([0-9a-zA-Z_$, ]*)\\) *{(.*)}
For some reason, $1 and $2 are returning the same value.
The target string is:
public function messenger(text){
sendMsg(text);
}
private function sendMsg(text){
alert(text);
}
How can I fix that? By the way, I am using Javascript.
EDIT:
Ok, the answers worked, but the problem now is that the last paramenter is returning "sendMsg(text); } private function sendMsg(text){ alert(text);}", it is not stopping in the first "}"