我想从 java 代码中提取所有方法调用。我写了以下两个正则表达式,但它们无法提取所有方法调用。
注册1:Pattern.compile("([a-zA-Z][0-9_a-zA-Z]*\\([a-zA-Z0-9_\\s,\\[\\]\\(\\)\\.]+\\))");
注册2:Pattern.compile("([a-zA-Z][0-9_a-zA-Z]*\\([\\s]*\\))")
输入:
"{
if ((war == null) && (config != null)) {
sb.append( &config= );
sb.append(URLEncoder.encode(config,getCharset()));
}
if ((war == null) && (localWar != null)) {
sb.append( &war= );
sb.append(URLEncoder.encode(localWar,getCharset()));
}
if (update) {
sb.append( &update=true );
}
if (tag != null) {
sb.append( &tag= );
sb.append(URLEncoder.encode(tag,getCharset()));
}
}"
输出:
getCharset getCharset getCharset append append append
我无法提取“ encode
”。
有谁知道我应该在正则表达式中添加什么?