com.tmsps.ne4spring.utils.HtmlUtil Maven / Gradle / Ivy
package com.tmsps.ne4spring.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author zhangwei [email protected]
*
*/
public class HtmlUtil {
public static String html2Text(String inputString) {
if (inputString==null||"".equals(inputString)) {
return "";
}
String htmlStr = inputString; // 含html标签的字符串
String textStr = "";
java.util.regex.Pattern p_script;
java.util.regex.Matcher m_script;
java.util.regex.Pattern p_style;
java.util.regex.Matcher m_style;
java.util.regex.Pattern p_html;
java.util.regex.Matcher m_html;
java.util.regex.Pattern p_html1;
java.util.regex.Matcher m_html1;
try {
String regEx_script = "<[//s]*?script[^>]*?>[//s//S]*?<[//s]*?///[//s]*?script[//s]*?>"; // 定义script的正则表达式{或