public static String convertToRegexString ( final String input ) { return input . replaceAll ( "\\\\" , "\\\\" ) . replaceAll ( "\\*" , "\\*" ) . replaceAll ( "\\+" , "\\+" ) . replaceAll ( "\\]" , "\\]" ) . replaceAll ( "\\[" , "\\[" ) . replaceAll ( "\\(" , "\\(" ) . replaceAll ( "\\)" , "\\)" ) . replaceAll ( "\\?" , "\\?" ) . replaceAll ( "\\$" , "\\$" ) . replaceAll ( "\\|" , "\\|" ) . replaceAll ( "\\^" , "\\^" ) . replaceAll ( "\\." , "\\." ) ; }
Converts a string so that it can be used in a regular expression .