使用正则表达式匹配JS函数代码
String someFunction="init";
Pattern regex = Pattern.compile(
"function\\s*?"+someFunction+"\\(.*?\\)\\s*?\\{[^{}]*?(\\{.*?\\})*[^{}]*?\\}"
, Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);
原文:http://www.cnblogs.com/lyq-blogs/p/java_regex_catch_function.html