Regex, match "private function", "public function" or just "function"

Posted by M28 on Stack Overflow See other posts from Stack Overflow or by M28
Published on 2010-04-06T22:44:02Z Indexed on 2010/04/06 22:53 UTC
Read the original article Hit count: 281

Filed under:

I am getting some problems while trying to use this regex:

(public +function|private +function|function) +

For some reason, $1 and $2 are returning the same value.

How can I fix that? By the way, I am using Javascript

© Stack Overflow or respective owner

Related posts about regex