 <p>This should be very easy. Valid function names can only consist of alphanumerics, parenthesis, and possibly parameter values within the parens (i don't know enough javascript to know whether parameters are defined in the function call) and must start with a letter, correct? Therefore to validate that a string is a valid function name. Therefore this should work:</p> <pre><code>[a-xA-z]+[a-zA-z0-9_]\*(\\(.*?\\))\* </code></pre>