code: public String patternToRegex(String string)
      {
          if (string != null)
              if (!string.contains("["))
                   if (!string.contains("{"))  // If it has one of these, it probably is a regex already.
                       if (!string.contains("\\."))
          {
              string = string.replace(".", "\\.");
              string = string.replace("*", ".*");
          }
          return string;
      }
docs: Kind of convert file filter to regex.