Break up JS file into function parts, name, arguments and body
This will match all named functions.
PHP code to print:
$js = file_get_contents('http://somedomain.com/javascript.js');
$regex = "/function\s+(?\w+)\s\((?(?:+))?\s\)\s(?{(?:+|(?-1))*+})/";
preg_match_all($regex, $js, $jsFunctions, PREG_PATTERN_ORDER);...
Submitted by Alan Halls - 8 years ago