日期:2014-05-20 浏览次数:20828 次
String input="/*IF name!=null && !\"\".equals(name)*/\nAND t1.name like '%/*name*/%'\n/*END*/"; System.out.println(input); Pattern p = Pattern.compile("/\\*IF[^\\%]*\\*/(.*)/\\*END\\*/", Pattern.DOTALL); Matcher mc = p.matcher(input); String result=mc.replaceAll("$1"); System.out.println("*************************"); System.out.println(result);
------解决方案--------------------
楼主的意思是最后的结果应该是:
AND t1.name like '%/*name*/%'