code: private boolean wildcardMatches(String pattern, String stringToMatch) {
          boolean match = false;
          int length = pattern.length();
          if(pattern.charAt(0) == '*') {
              if(length == 1) {
                  match = true; // *
              } else if(pattern.charAt(length-1) == '*' && length > 2 && stringToMatch.contains(pattern.substring(1, length-3).toLowerCase())) {
                  match = true; // *match*
              } else if(length > 1 && stringToMatch.endsWith(pattern.substring(1).toLowerCase())) {
                  match = true; // *match
              }
          } else if(pattern.charAt(length-1) == '*' && stringToMatch.startsWith(pattern.substring(0, length-2).toLowerCase())) {
              match = true; // match*
          } else if(pattern.equalsIgnoreCase(stringToMatch)) { // match
              match = true;
          }
          return match;
      }
docs: Gets whether a string matches a wildcard pattern. The following would be considered to be matches:
  <code>*pattern   somepattern</code>
  <code>pattern*   patternsome</code>
  <code>*pattern*  somepatternsome</code>
  @param pattern The pattern to check, wildcards must be at either the start, end or both, but not in the middle.
  @param stringToMatch The string to check
  @return <code>True</code> if the wildcard matches the pattern, otherwise <code>false</code>