使用正则表达式匹配JS函数代码
String someFunction="init";
Pattern regex = Pattern.compile(
"function\\s*?"+someFunction+"\\(.*?\\)\\s*?\\{[^{}]*?(\\{.*?\\})*[^{}]*?\\}"
, Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);
2022-07-16 14:01:19
使用正则表达式匹配JS函数代码
String someFunction="init";
Pattern regex = Pattern.compile(
"function\\s*?"+someFunction+"\\(.*?\\)\\s*?\\{[^{}]*?(\\{.*?\\})*[^{}]*?\\}"
, Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);