public static String filterHtmlStr(String str) {
if (str == null) {
return null;
}
Pattern pattern = Pattern.compile("<script[\\s\\S]*?</script>|<style[\\s\\S]*?</style>|<[^>]+>|&.{1,8};", Pattern.DOTALL);
Matcher m = pattern.matcher(str);
String result = m.replaceAll("");
return result;
}
Java过滤 HTML标签
最新推荐文章于 2023-06-29 14:20:53 发布