Return `true` when pathname match the rule.

@param req
@param pathname
@param rule
@returns {*}
500179
function isMatchRule(req, pathname, rule) {
  if (typeof rule === 'string') {
    return pathname.indexOf(rule) > -1;
  } else if (rule instanceof RegExp) {
    return rule.test(pathname);
  } else if (typeof rule === 'function') {
    return rule(pathname, req);
  }
}
982584
function matchesPath(requestedUrl, opts) {
  var paths = !opts.path || Array.isArray(opts.path) ?
    opts.path : [opts.path];

  if (paths) {
    return paths.some(function(p) {
      return (typeof p === 'string' && p === requestedUrl.pathname) ||
        (p instanceof RegExp && !! p.exec(requestedUrl.pathname));
    });
  }

  return false;
}
75371
def match(self, path: str) -> Tuple[Optional[Dict[str, Any]], bool]:
        
        match = self._pattern.match(path)
        if match is not None:
            # If the route is a branch (not leaf) and the path is
            # missing a trailing slash then it needs one to be
            # considered a match in the strict slashes mode.
            needs_slash = (
                self.strict_slashes and not self.is_leaf and match.groupdict()['__slash__'] != '/'
            )
            try:
                converted_varaibles = {
                    name: self._converters[name].to_python(value)
                    for name, value in match.groupdict().items()
                    if name != '__slash__'
                }
            except ValidationError:  # Doesn't meet conversion rules, no match
                return None, False
            else:
                return {**self.defaults, **converted_varaibles}, needs_slash
        else:
            return None, False
629688
private boolean matchPath(String expected, String actual) {

        return CmsStringUtil.joinPaths(actual, "/").equals(CmsStringUtil.joinPaths(expected, "/"));
    }
170387
public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) {
        requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex));
        query.put(parameter, example);
        return this;
    }
1117914
public boolean exists (HttpServletRequest req, String path)
    {
        return (getMessage(req, path, false) != null);
    }
247875
function isPathChild(pathA, pathB) {
  const relPath = relative(normalizePath(pathA), normalizePath(pathB));
  return relPath === '..';
}
1306350
public static Predicate<String> regex(final String pathRegex) {
    return new Predicate<String>() {
      @Override
      public boolean test(String input) {
        return input.matches(pathRegex);
      }
    };
  }
875699
public static boolean isPathNameMatch(String uri, String urlPattern) {
        if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) {
            String s = urlPattern.substring(0, urlPattern.length() - 1);
            /**
             * First case,urlPattern
             * /a/b/c/ matches /a/b/c/*
             **/
            if (s.equalsIgnoreCase(uri)) {
                return true;
            }
            /**
             * Second case
             * /a/b/c matches /a/b/c/*
             **/
            if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) {
                return true;
            }

            /**
             * Third case
             * /a/b/c/d/e matches /a/b/c/*
             **/
            if (uri.startsWith(s)) {
                return true;
            }
        }

        return false;
    }
1238726
function match(routes = [], path) {
  for (var i = 0; i < routes.length; i++) {
    var re = pathRegexps[routes[i].path] || pathToRegexp(routes[i].path);
    pathRegexps[routes[i].path] = re;

    if (re && re.test(path)) {
      return { re, route: routes[i] };
    }
  }

  return false;
}
190673
public boolean blocksPathForUA(String path, String ua) {

		if(rules.containsKey(ua.toLowerCase())) {

			return blocksPath(path,ua,rules.get(ua.toLowerCase()));

		} else if(rules.containsKey(GLOBAL_USER_AGENT)) {

			return blocksPath(path,GLOBAL_USER_AGENT,
					rules.get(GLOBAL_USER_AGENT));			
		}
		return false;
	}
370337
public boolean exists(String path) {
        Iterator i = vHostTable.keySet().iterator();

        while (i.hasNext()) {
            try {
                String pattern = (String) i.next();
                // System.out.println("Pattern = "+pattern);
                if (path.matches(pattern))
                    return true;
            } catch (Exception e) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught an exception in exists():", e);
                }
                return false;
            }
        }

        return false;
    }
1322754
public boolean matchesFilter(String filter) {

        filter = filter.toLowerCase();
        return m_title.toLowerCase().contains(filter) || m_path.toLowerCase().contains(filter);
    }
1238287
public PactDslRequestWithPath matchQuery(String parameter, String regex) {
        return matchQuery(parameter, regex, new Generex(regex).random());
    }
296936
def match(self, rule):
        
        if self.methods:
            for method in self.methods:
                if method in rule.methods:
                    return True

        if self.endpoints:
            for endpoint in self.endpoints:
                if endpoint == rule.endpoint:
                    return True

        return False
684365
private function matchPatterns($pathName, $patternList)
    {
        foreach ($patternList as $pattern) {
            if ($this->matchPattern($pathName, $pattern)) {
                return $pattern;
            }
        }

        return false;
    }
86255
function matchRoute(route, path) {

  if (route.pattern === undefined && route.path !== undefined) {
    var routePattern;

    if (route.path instanceof RegExp) {
      routePattern = route.path;
    } else {
      var routePath = normalize(route.path);
      routePattern = route.children.length > 0 ? routePath + '*' : routePath;
    }

    Object.defineProperty(route, 'pattern', {
      enumerable: false,
      value: pattern.newPattern(routePattern)
    });
  }

  if (route.pattern) {
    var match = route.pattern.match(path);

    if (match) {
      if (route.pattern.isRegex) {
        match = {_: match};
      }

      if (!match._ || match._[0] === '/' || match._[0] === '') {
        delete match._;
      }
    }

    return match;

  } else {
    return path === '/' || path === '' ? {} : {_: [path]};
  }
}