Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收到电子邮件并试图在 div 的页面上显示它们。但是我收到的邮件包含 body css 之类的body{background-color: #444}让我的页面看起来很奇怪。我正在尝试body从 css 中删除规则。我使用 jsoup 得到了样式标签 html,唯一的问题是如何通过正则表达式删除规则?
body{background-color: #444}
body
试试这个:
String withoutBody = text.replaceAll("body\\s*\\{.*?\\}", "");
笔记;
{}
?
.*?
}