67,550
社区成员




String sql = "select * from mytable where field1 in (:field1) and field2 in (:field2)";
Pattern reg = Pattern.compile("\\((:[^\\)]+)\\)");
Matcher m = reg.matcher(sql);
while(m.find()){
System.out.println(m.group(1));
}
如果格式不固定,要用SQL解析器了,参考:
https://github.com/alibaba/druid/wiki/SQL-Parser