code: private String replaceMetaChars(String input) {
      //escape backslash first since that character is used to escape the remaining meta chars
      input = input.replaceAll("\\\\", "\\\\\\");
  
      //don't escape star - it's used as the wildcard
      input = input.replaceAll(Pattern.quote("]"), "\\\\]");
      input = input.replaceAll(Pattern.quote("["), "\\\\[");
      input = input.replaceAll(Pattern.quote("^"), "\\\\^");
      input = input.replaceAll(Pattern.quote("$"), "\\\\$");
      input = input.replaceAll(Pattern.quote("."), "\\\\.");
      input = input.replaceAll(Pattern.quote("|"), "\\\\|");
      input = input.replaceAll(Pattern.quote("?"), "\\\\?");
      input = input.replaceAll(Pattern.quote("+"), "\\\\+");
      input = input.replaceAll(Pattern.quote("("), "\\\\(");
      input = input.replaceAll(Pattern.quote(")"), "\\\\)");
      input = input.replaceAll(Pattern.quote("-"), "\\\\-");
      input = input.replaceAll(Pattern.quote("{"), "\\\\{");
      input = input.replaceAll(Pattern.quote("}"), "\\\\}");
      input = input.replaceAll(Pattern.quote("#"), "\\\\#");
      return input;
    }
docs: Some perl5 characters may occur in the log file format.
  Escape these characters to prevent parsing errors.
  
  @param input
  @return string