Regex for finding all javascript functions including arrow notation?

Viewed 108

I'd like to programatically find all javascript functions and add some code for profiling purposes (to count how many times they are called). Is there any existing tool or a regex to do that?

It is relatively easy to write something like:

function\s+\w+\(.*?\)\s*{

But that only begins to cover the multitude of options.

2 Answers
Related