code: protected static boolean matches( String text , String pattern , boolean ignoreCase )
      {
          if (text == null)
              return false;
          if (pattern.length() == 0)
              return text.length() == 0;
          
          int textPos = 0;
          boolean startWithAny = false;
          StringTokenizer st = new StringTokenizer(pattern,"*?",true);
          while (st.hasMoreTokens())
          {
              String subPattern = st.nextToken();
              
              if (subPattern.equals("*"))
              {
                  startWithAny = true;
              }
              else
              if (subPattern.equals("?"))
              {
                  if (textPos < text.length())
                      textPos++;
                  else
                      return false;
              }
              else
              {
                  if (startWithAny)
                  {
                      textPos = indexOf(text,subPattern,textPos,ignoreCase);
                      if (textPos == -1) return false;
                      startWithAny = false;
                  }
                  else
                  {
                      if (!startsWith(text,subPattern,textPos,ignoreCase))
                          return false;
                  }
                  textPos += subPattern.length();
              }
          }
          
          // Remaining text
          if (textPos < text.length())
              if (!startWithAny)
                  return false;
          
          return true;
      }
docs: Check if the given text matches a pattern