code: public static boolean matchPattern(String name, String pattern) {
          if (name == null || pattern == null) {
              return false;
          }
  
          if (name.equals(pattern)) {
              // exact match
              return true;
          }
  
          if (matchWildcard(name, pattern)) {
              return true;
          }
  
          if (matchRegex(name, pattern)) {
              return true;
          }
  
          // no match
          return false;
      }
docs: Matches the name with the given pattern.
  <p/>
  The match rules are applied in this order:
  <ul>
  <li>exact match, returns true</li>
  <li>wildcard match (pattern ends with a * and the name starts with the pattern), returns true</li>
  <li>regular expression match, returns true</li>
  <li>otherwise returns false</li>
  </ul>
  
  @param name    the name
  @param pattern a pattern to match
  @return <tt>true</tt> if match, <tt>false</tt> otherwise.