protected String escapeComments(String string) {
        final Pattern pattern = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL);
        final Matcher matcher = pattern.matcher(string);
        StringBuffer buf = new StringBuffer();
        if (matcher.find()) {
            String match = matcher.group(1); // (.*?)
            matcher.appendReplacement(buf, "<!--" + htmlSpecialChars(match) + "-->");
        }
        matcher.appendTail(buf);

        return buf.toString();
    }