@since 0.0.1
@author Igor Ivanovic
@method RouteRule#match

@description
Match named
3222
function RouteRule_match(rgx, str) {
        var group, matched, data = [];
        if (Type.isString(rgx)) {
            rgx = this.toRegex(rgx);
        }
        if (Type.isObject(rgx) && Type.isRegExp(rgx.regex)) {
            if (rgx.group && rgx.group.length) {
                group = rgx.group;
                matched = core.match(rgx.regex, str).shift();
                if (Type.isArray(matched)) {
                    matched = matched.slice(1, matched.length - 2);
                    group.forEach(function (item) {
                        data.push({
                            key: item.isNamed ? item.key : false,
                            index: item.index,
                            value: matched[item.index]
                        });
                    });
                }
            } else {
                return core.match(rgx.regex, str);
            }
        } else if (Type.isRegExp(rgx)) {
            return core.match(rgx, str);
        }
        return data;
    }
511893
def MatchRouter(self, request):
    """"""
    router = api_auth_manager.API_AUTH_MGR.GetRouterForUser(request.user)
    routing_map = self._GetRoutingMap(router)

    matcher = routing_map.bind(
        "%s:%s" %
        (request.environ["SERVER_NAME"], request.environ["SERVER_PORT"]))
    try:
      match = matcher.match(request.path, request.method)
    except werkzeug_exceptions.NotFound:
      raise ApiCallRouterNotFoundError("No API router was found for (%s) %s" %
                                       (request.path, request.method))

    router_method_metadata, route_args_dict = match
    return (router, router_method_metadata,
            self._GetArgsFromRequest(request, router_method_metadata,
                                     route_args_dict))
727723
def matches?(*rules)
      rules.flatten!
      match   = self.local.matches?(rules)
      match ||= self.host.matches?(rules)
      return match if match

      # Does "root@*.com" match "root@example.com" domain name
      rules.each do |r|
        if r =~ /.+@.+/
          return r if File.fnmatch?(r, self.to_s)
        end
      end
      false
    end
164525
def match(self, name):
        
        for pat in self.pats:
            if fnmatch.fnmatch(name, pat):
                return True

        return False
495681
def check_match(self, name):
        
        return any(pattern.match(name) for pattern in self.patterns)
1366883
function (protocol) {
        var matchRegexObject = this._matchPatternObject;

        return _.includes(ALLOWED_PROTOCOLS, protocol) &&
            (_.includes(matchRegexObject.protocols, MATCH_ALL) || _.includes(matchRegexObject.protocols, protocol));
    }
875448
function RouteRule_toObject(arr) {
        var nObj = {};
        Object.keys(arr).forEach(function (key) {
            nObj[key] = arr[key];
        });
        return nObj;
    }
991808
function rule_match_options_page( $match, $rule, $options )
	{
		global $plugin_page;
		    	
		// NOTE
		// comment out below code as it was interfering with custom slugs
		
		// older location rules may be "options-pagename"
		/*
if( substr($rule['value'], 0, 8) == 'options-' )
		{
			$rule['value'] = 'acf-' . $rule['value'];
		}
*/
		
		
		// older location ruels may be "Pagename"
		/*
if( substr($rule['value'], 0, 11) != 'acf-options' )
		{
			$rule['value'] = 'acf-options-' . sanitize_title( $rule['value'] );
			
			// value may now be wrong (acf-options-options)
			if( $rule['value'] == 'acf-options-options' )
			{
				$rule['value'] = 'acf-options';
			}
		}
*/
	
		
		if($rule['operator'] == "==")
        {
        	$match = ( $plugin_page === $rule['value'] );
        }
        elseif($rule['operator'] == "!=")
        {
        	$match = ( $plugin_page !== $rule['value'] );
        }
        
        
        return $match;
        
    }
492986
function(route) 
	{
		var rootStripper 	= /^\/+|\/+$/g;
		var optionalParam 	= /\((.*?)\)/g;
		var namedParam		= /(\(\?)?:\w+/g;
		var splatParam		= /\*\w+/g;
		var escapeRegExp	= /[\-{}\[\]+?.,\\\^$|#\s]/g;
		
		route = route
			.replace(rootStripper, '')
			.replace(escapeRegExp, '\\$&')
			.replace(optionalParam, '(?:$1)?')
			.replace(namedParam, function(match, optional)
			{
				return optional ? match : '([^\/]+)';
			})
			.replace(splatParam, '(.*?)');
		
		return new RegExp('^' + route + '$');
	}
663282
function Routing() {

    var self        = {};

    /**
     * @function getRoute
     *
     * @param {string} rule e.g.: <name>[@<bundle>]
     * @param {object} params
     *
     * @return {object} route
     * */
    self.getRoute = function(rule, params) {

        var config      = getContext('gina').config
            , bundle    = null;

        if ( /\@/.test(rule) ) {
            bundle = rule.split(/\@/)[1];
        } else {
            bundle    = config.bundle
        }

        var env     = config.env
        , routing   = config.getRouting(bundle, env);

        if ( typeof(routing[rule]) == 'undefined' ) {
            throw new Error('[ RoutingHelper::getRouting(rule, params) ] : `' +rule + '` not found !')
        }

        var route = JSON.parse(JSON.stringify(routing[rule]));
        var variable = null
        for (var p in route.param) {
            if ( /^:/.test(route.param[p]) ) {
                variable = route.param[p].substr(1);
                if ( typeof(params[variable]) != 'undefined') {
                    route.url = route.url.replace( new RegExp('(/:'+variable+'|/:'+variable+'$)', 'g'), '/'+ params[variable] );

                    if ( typeof(route.param.path) != 'undefined' && /:/.test(route.param.path) ) {
                        route.param.path = route.param.path.replace( new RegExp('(:'+variable+'/|:'+variable+'$)', 'g'), params[variable]);
                    }
                }
            }
        }

        if ( Array.isArray(route.url) ) {
            route.url = route.url[0]
        }

        return route

    };

    /**
     * Get route by url
     * N.B.: this will only work with rules declared with `GET` method property
     *
     * @function getRouteByUrl
     *
     * @param {string} url e.g.: /bundle/some/url/path or http
     * @param {string} [bundle] targeted bundle
     *
     * @return {object} route
     * */
    self.getRouteByUrl = function (url, bundle) {

        var matched         = false
            , pathname      = null
            , gnaCtx        = getContext('gina')
            , config        = gnaCtx.config
            , bundle        = ( typeof(bundle) != 'undefined' ) ? bundle : config.bundle
            , env           = config.env
            , router        = new gnaCtx.Router(env)
            , routing       = config.getRouting(bundle, env)
            , isRoute       = null
            , route         = null
            , isXMLRequest  = getContext().router.isProcessingXMLRequest
        ;

        var hostname    = config.envConf[bundle][env].hostname
            , uri       = config.envConf[bundle][env].server.webroot
            , prefix    = hostname + uri;

        pathname = url.replace( new RegExp('^'+ hostname), '');

        var request = {
            routing: {
                path: unescape(pathname)
            },
            method: 'GET',
            params: {}

        };

        out:
            for (var rule in routing) {
                if (typeof(routing[rule]['param']) == 'undefined')
                    break;

                if (routing[rule].bundle != bundle) continue;

                // this will only work with rules declared with `GET` method property
                if ( typeof(routing[rule].method) != 'undefined' && !/^get$/i.test(routing[rule].method) ) continue;

                //Preparing params to relay to the router.
                params = {
                    method              : routing[rule].method || 'GET',
                    requirements        : routing[rule].requirements,
                    namespace           : routing[rule].namespace || undefined,
                    url                 : unescape(pathname), /// avoid %20
                    rule                : routing[rule].originalRule || rule,
                    param               : routing[rule].param,
                    middleware          : routing[rule].middleware,
                    bundle              : routing[rule].bundle,
                    isXMLRequest        : isXMLRequest
                };

                //Parsing for the right url.
                try {
                    isRoute = router.compareUrls(request, params, routing[rule].url);
                } catch (err) {
                    throw new Error('Rule [ '+rule+' ] needs your attention.\n' + err.stack);
                    break;
                }

                if (isRoute.past) {

                    route = JSON.parse(JSON.stringify(routing[rule]));

                    matched = true;
                    isRoute = {};
                    break out;

                }
            }

        if (!matched) {
            throw new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle]) ] : route not found for url: `' + url + '` !')
        } else {
            return route
        }

    }

    return self
}
1276858
def match(self, route):
        
        _resource = trim_resource(self.resource)
        self.method = self.method.lower()
        resource_match = route.resource_regex.search(_resource)
        if resource_match is None:
            return None

        # build params and querystring
        params = resource_match.groupdict()
        querystring = params.pop("querystring", "")
        setattr(self, "param", params)
        setattr(self, "query", parse_querystring(querystring))

        return copy.deepcopy(self)
875383
function describeRoute(route) {
		var host = route.Host;
		var domain = route.DomainName;
		var apps = route.Apps;
		var appsNum = route.Apps.length;

		var strResult = "\n" + host + "\t" + domain;

		if(appsNum != 0){
			strResult += "\t" + route.Apps[0].Name;
			if(appsNum > 1){
				for(var i = 1; i < appsNum; i++){
					strResult += ", " + route.Apps[i].Name;
				}
			}
		}
		return strResult;
	}
220827
function queryMatchesAfterIncluding(matches, includeClause) {
  if (!includeClause) {
    return matches;
  }

  const includeClauses = includeClause.split(',');
  matches = _.map(matches, match => {
    for (let i = 0; i < includeClauses.length; i++) {
      const paths = includeClauses[i].split('.');
      match = includePaths(match, paths);
    }
    return match;
  });

  return matches;
}
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);
  }
}
788247
def lookup(selector)
      unless routes.nil?
		routes.each do |pattern, keys, block|

          if match = pattern.match(selector)
            match = match.to_a
            url = match.shift

            params = to_params_hash(keys, match)

            #
            # @todo think about this
            #
            @params = params

            return params, block
          end
        end
      end

      unless @default_route.nil?
        return {}, @default_route
      end

      raise Gopher::NotFoundError
    end
1364050
function isActive(_ref, indexOnly, currentLocation, routes, params) {
  var pathname = _ref.pathname;
  var query = _ref.query;

  if (currentLocation == null) return false;

  // TODO: This is a bit ugly. It keeps around support for treating pathnames
  // without preceding slashes as absolute paths, but possibly also works
  // around the same quirks with basenames as in matchRoutes.
  if (pathname.charAt(0) !== '/') {
    pathname = '/' + pathname;
  }

  if (!pathIsActive(pathname, currentLocation.pathname)) {
    // The path check is necessary and sufficient for indexOnly, but otherwise
    // we still need to check the routes.
    if (indexOnly || !routeIsActive(pathname, routes, params)) {
      return false;
    }
  }

  return queryIsActive(query, currentLocation.query);
}
806662
function route_(element, newURL, alreadyShown) {
    let lastMatch = null;
    let newHash = newURL.split('#')[1] || '';
    let lastHash = newHash.split('/').reverse()[0];
    let match = lastHash.match(
      new RegExp(element.getAttribute('hash')));
    let parents = [element];

    // if match...
    if (match && match[0] === lastHash &&
      (match.length === 1 ||
      !document.querySelector(`[hash="${lastHash}"]`))) {

      // match_ newHash pushing all matched elements to parents
      lastMatch = match_(newHash, parents, []);

      // if default route do not match
      if ((lastMatch !== newHash) && (element.getAttribute('hash') === '')) {
        lastMatch = null;
      } else {
        match = newHash.match(new RegExp(parents.reduce((acc, curr) => {
          curr && (acc = curr.getAttribute('hash') + (acc ? '/' : '') + acc);
          return acc;
        }, '')));
        (!match) && (lastMatch = null);

        // unhide all matched elements
        match && parents.forEach(element => element && unhide_(element));

        // hide_ last elements. I mean, if go
        // from /page1/page2/page3
        // to   /page1/page2/page5
        // then hide only page3
        match &&
          (alreadyShown instanceof Array) &&
          alreadyShown.reduce((acc, curr) => {
            curr && !parents.includes(curr) && acc.push(curr);
            return acc;
          }, []).reverse().forEach(item => hide_(item));

        // if match, and no stateRevert then update lastMatch and dispatch show
        match && !stateRevert && (lastMatch = parents) &&
          dispatchShow_(element, match.slice(1)
          .reduce((detail, hash, i) => {
            detail[`param${i + 1}`] = hash;
            return detail;
          }, { router: element }));
      }
    } else {
      // do not hide elements unnecessarily
      if (!(alreadyShown.find &&
          alreadyShown.find(show => show === element))) {
        hide_(element);
      }
    }
    return lastMatch;
  }