java去除采集网页多余标签和内容正则

//定义script的正则表达式{或<script[^>]*?>[\s\S]*?<\/script>
String regEx_script = "<[\s]*?script[^>]*?>[\s\S]*?<[\s]*?\/[\s]*?script[\s]*?>";
//定义style的正则表达式{或<style[^>]*?>[\s\S]*?<\/style>
String regEx_style = "<[\s]*?style[^>]*?>[\s\S]*?<[\s]*?\/[\s]*?style[\s]*?>";
// 定义HTML标签的正则表达式
String regEx_html = "<[^>]+>";
// 定义一些特殊字符的正则表达式 如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String regEx_special = "\&[a-zA-Z]{1,10};";
原文地址:https://www.cnblogs.com/guanxiaohe/p/14097904.html