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);    
    }
}