java 正则表达式
来源:百度知道 编辑:UC知道 时间:2024/06/03 10:37:41
取出 <tr> </tr>里面的东西
我猜你要的其实是JAVACRIPT,而不是JAVA,所以两个都给你.
javascript:
result 是存到这个变量
SUBJECT是原字串
result = subject.replace(/<br>(.*?)<\/br>/g, "$1");
JAVA:
try {
String resultString = subjectString.replaceAll("<br>(.*?)</br>", "$1");
} catch (PatternSyntaxException ex) {
// Syntax error in the regular expression
} catch (IllegalArgumentException ex) {
// Syntax error in the replacement text (unescaped $ signs?)
} catch (IndexOutOfBoundsException ex) {
// Non-existent backreference used the replacement text
}