小弟手里有这样一个文本文件:
1 02
http://news.xinhuanet.com/edu/2006-03/08/content_4276043.htm<html>
网页代码
</html>2 08
http://news.xinhuanet.com/edu/2006-03/08/content_4276043.htm<html>
网页代码
</html>
.
.
.
.
一共有1000多个这样的段落我想把每个段落<html></html>以及中间的内容去掉,其他全部保留,想了很长时间也没想出来该怎么弄,请各位高手帮帮忙,小弟先谢了

解决方案 »

  1.   

    replaceAll("<html></html>","");仅供参考,关注
      

  2.   

    把文件的内容先读出,替换完成之后,然后写txt
      

  3.   

    如果<html></html>匹配
    str=str.replaceAll("<html>.*</html>","");
      

  4.   

    有个开源得html解析工具可以做到. htmlparser
      

  5.   

    String regEx="</?[^>]+>";//"<textarea>(\\s|.)*</textarea>";     Matcher m= Pattern.compile(regEx).matcher(str);        while(m.find())
    System.out.println(m.group());
            System.out.println(m.replaceAll(""));
           }