日期:2014-05-17 浏览次数:21183 次
String str="页面开始" +
"<!-- 从这里开始截取 -->" +
"需要被截取出来的部分" +
"<!-- 截取到这里 -->" +
"页面其他部分页面结束";
Pattern p = Pattern.compile("<!-- 从这里开始截取 -->(.*?)<!-- 截取到这里 -->");
Matcher m = p.matcher(str);
while(m.find()){
System.out.println(m.group(1));
}
------解决方案--------------------