wxpython富文本_去除富文本编辑器中的标签
public static String deRegularExpression(String content) {
content = deRegularScript(content); // 過(guò)濾script標(biāo)簽
String regEx_style = "
/* String regEx_inStyle = "style=\"([^\";]+;?)+\""; */
String regEx_html = "<[^>]+>"; // 定義HTML標(biāo)簽的正則表達(dá)式
Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
Matcher m_style = p_style.matcher(content);
content = m_style.replaceAll(""); // 過(guò)濾style標(biāo)簽
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(content);
content = m_html.replaceAll(" "); // 過(guò)濾html標(biāo)簽
// 去除?
Pattern pattern = Pattern.compile("?");
Matcher matcher = pattern.matcher(content);
content = matcher.replaceAll(" ");
return content.trim(); // 返回文本字符串
}
public static String deRegularScript(String content) {
String regEx_script = "
Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
Matcher m_script = p_script.matcher(content);
return m_script.replaceAll(""); // 過(guò)濾script標(biāo)簽
}
總結(jié)
以上是生活随笔為你收集整理的wxpython富文本_去除富文本编辑器中的标签的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: mysql慢查询日志分析工具比较_MyS
- 下一篇: 编写一个函数,该函数能判断一个英文句子s