diff --git a/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java b/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java index be915ad2a..b34ec1fe0 100644 --- a/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java +++ b/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java @@ -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); // 非自闭标签小写