If you are using Java 1.5+ you should use Pattern.quote() to quote a string. Otherwise, just put \Q and \E around the string (that would be "\\Q" and "\\E" of course, when written out). These special forms quote the things between them.