public static String quote(String input){
  String output="";
  for (int i=0; i < input.length(); i++) {
    output+="\\" + input.charAt(i);
  }
  return output;
}

public static String quote ( String input ) { String output = "" ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { output += "\\" + input . charAt ( i ) ; } return output ; }
escape a provided string so that it will be interpreted as a literal in regular expressions . the current implementation does escape each character even if not neccessary , generating verbose literals .
