This commit is contained in:
Looly 2022-03-24 09:37:26 +08:00
parent d4a24180a4
commit 163dff00bd

View File

@ -127,10 +127,10 @@ public class HtmlUtil {
// (?i)表示其后面的表达式忽略大小写
if (withTagContent) {
// 标签及其包含内容
regex = StrUtil.format("(?i)<{}(\\s+[^>]*)?/?>(.*?</{}>)?", tagName, tagName);
regex = StrUtil.format("(?i)<{}(\\s+[^>]*?)?/?>(.*?</{}>)?", tagName, tagName);
} else {
// 标签不包含内容
regex = StrUtil.format("(?i)<{}(\\s+[^>]*)?/?>|</?{}>", tagName, tagName);
regex = StrUtil.format("(?i)<{}(\\s+[^>]*?)?/?>|</?{}>", tagName, tagName);
}
content = ReUtil.delAll(regex, content); // 非自闭标签小写