【光环助手V4.5.0】论坛搜索功能及部分优化UI测试 https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/1049

This commit is contained in:
张玉久
2020-11-25 11:00:35 +08:00
parent 3ee30f05f0
commit b3e859678e
6 changed files with 59 additions and 35 deletions

View File

@ -67,4 +67,15 @@ public class HtmlUtils {
return htmlStr.trim(); //返回文本字符串
}
/**
* 过滤掉标签,保留标签内容
*/
public static String filterHtmlLabel(String htmlStr) {
String regEx_html = "<[^>]+>([\\s\\S]*?)<\\/[^>]+>"; //定义HTML标签的正则表达式
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll("$1"); //过滤html标签
return htmlStr.trim(); //返回文本字符串
}
}