java remove html tags

public static String stripHtml(String content) {
// <p> paragraphs are replaced with newlines
content = content.replaceAll("<p .*?>", "\r\n");
// <br><br/> is replaced with a newline
content = content.replaceAll("<br\\s*/?>", "\r\n");
// remove everything between other <>
content = content.replaceAll("\\<.*?>", "");
// restore HTML
// content = HTMLDecoder.decode(content);
return content;
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324837218&siteId=291194637