var bodyRegExp = /function[\\s]+[(].+[)][\\s]+{(.+)}/;
bodyRegExp.exec("module.exports = function () { /* any content */ }");
you cannot use regular expressions to parse JavaScript language syntax because the grammar for that language is too complex for what regex can do.