String startRegex = "(<|<f|<fo|<fon|<font|<font |<font c|<font co|<font col|<font colo|<font color|<font color=|<font color='|<font color='r|<font color='re|<font color='red|<font color='red'|<font color='red'>|<font color='red'>)$"; Pattern pat = Pattern.compile(startRegex); Matcher matcher = pat.matcher(content); while (matcher.find()) { content = content.replaceAll(startRegex,""); } String endRegex = "(</f|</fo|</fon|</font)$"; Pattern pat1 = Pattern.compile(endRegex); Matcher matcher1 = pat1.matcher(content); while (matcher1.find()) { content = content.replaceAll(endRegex,"</font>"); } String regex = "(<font color='red'>.*)$"; Pattern pat2 = Pattern.compile(regex); Matcher matcher2 = pat2.matcher(content); while (matcher2.find()) { content = content + "</font>"; } (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|