import java.util.regex.*;public class test {
public static void main(String[] args) {
String str = "<table width=\"100%\"><tr><td>The table element contains all other elements that specify caption...</td></tr></table>";
Pattern p = Pattern.compile("[^<|/]table");
Matcher m = p.matcher(str);
String newStr = m.replaceAll(" <font color='red'>table</font>");
System.out.println(newStr);
}
}
public static void main(String[] args) {
String str = "<table width=\"100%\"><tr><td>The table element contains all other elements that specify caption...</td></tr></table>";
Pattern p = Pattern.compile("[^<|/]table");
Matcher m = p.matcher(str);
String newStr = m.replaceAll(" <font color='red'>table</font>");
System.out.println(newStr);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货