使用正则表达式匹配JS函数代码

使用正则表达式匹配JS函数代码

 

String someFunction="init";

 

Pattern regex = Pattern.compile("function\\s*?"+someFunction+"\\(.*?\\)\\s*?\\{[^{}]*?(\\{.*?\\})*[^{}]*?\\}", Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);

posted @ 2015-02-05 10:26  爪哇公民  阅读(720)  评论(0编辑  收藏  举报