String (String expression) { expression = expression.trim(); Matcher matcher = expressionMatcher.matcher(expression); if (matcher.matches()) { String operator = matcher.group(1); int lastAdded = 0; if (operator != null) { escapeBuffer.append('\\').append(operator); expression = matcher.group(2); } int total = expression.length(); for (int i = 0; i < total; i++) { char ch = expression.charAt(i); if ((ch == '*') || (ch == '?')) { escapeBuffer.append(expression, lastAdded, i); escapeBuffer.append('\\').append(ch); lastAdded = i + 1; } } if (escapeBuffer.length() > 0) { escapeBuffer.append(expression, lastAdded, total); expression = escapeBuffer.toString(); escapeBuffer.delete(0, escapeBuffer.length()); } } return expression; }