java 去掉html标签

public static String stripHtml(String content) { 
// <p>段落替换为换行 
content = content.replaceAll("<p .*?>", "\r\n"); 
// <br><br/>替换为换行 
content = content.replaceAll("<br\\s*/?>", "\r\n"); 
// 去掉其它的<>之间的东西 
content = content.replaceAll("\\<.*?>", ""); 
// 还原HTML 
// content = HTMLDecoder.decode(content); 
return content; 
}

 

posted @ 2018-04-25 16:05  有梦就能实现  阅读(293)  评论(0编辑  收藏  举报