code: public static boolean wildMatch(String text, String pattern) {
          if (pattern == null) return false;
  
          return text.matches(pattern.replace("?", ".?")
                  .replace("*", ".*?"));
      }
docs: The following Java method tests if a string matches a wildcard expression
  (supporting ? for exactly one character or * for an arbitrary number of characters):
  
  @param text    Text to test
  @param pattern (Wildcard) pattern to test
  @return True if the text matches the wildcard pattern