Evaluate the registered path-alias regular expressions
350479
def get_path_regex(self, path):
        
        for regex, func in self._regex_map:
            match = re.match(regex, path)
            if match:
                return func(match)

        return None, None
281463
function pathmap(path, spec, callback) {
  return spec.replace(regexp, function(match, replace, count, token) {
    var pattern;
    if (pattern = pathmap.patterns[token]) {
      return pattern.call(path, replace, count, callback);
    } else {
      throw new Error(
        'Unknown pathmap specifier ' + match + ' in "' + spec + '"');
    }
  });
}
630905
function (path, replace, replacement) {
    var _path = path.replace(replace, replacement).replace(new RegExp('/{2,}', 'giu'), '/');
    return _path !== '' ? _path : '/'
  }
195649
def path_regex(self):
        """"""
        regex = r'%(PREFIX)s%(BUILD)s/%(PLATFORM)s/%(LOCALE)s/'
        return regex % {'PREFIX': self.candidate_build_list_regex,
                        'BUILD': self.builds[self.build_index],
                        'LOCALE': self.locale,
                        'PLATFORM': self.platform_regex}
1346676
function getNameFromPath (path) {
  path = _(path).toString();
  let lastSlash = path.substring(0, path.length - 1).lastIndexOf("/");
  if (lastSlash === -1) {
    return normalizeName(path);
  }
  else {
    return normalizeName(path.substring(lastSlash));
  }
}
1284601
function(subpath, regs){
        for(var i = 0, len = regs.length; i < len; i++){
            var reg = regs[i];
            if(reg && fis.util.filter(subpath, reg)){
                return i;
            }
        }
        return false;
    }
1298779
def validate_pathname(filepath):
    '''

    '''
    if filepath == '/':
        return ValidatePathState.OK
    if len(filepath) > 1000:
        return ValidatePathState.LENGTH_ERROR
    filter2 = '\\?|"><:*'
    for c in filter2:
        if c in filepath:
            return ValidatePathState.CHAR_ERROR2
    paths = rec_split_path(filepath)
    filter3 = '.\r\n\t \0\x0b'
    for path in paths:
        if path[0] in filter3 or path[-1] in filter3:
            return ValidatePathState.CHAR_ERROR3
    return ValidatePathState.OK
637550
function () {
            var resolvedPath = '',
                resolvedPathStr,
                i,
                args = (arguments),
                path,
                absolute = 0;

            for (i = args.length - 1; i >= 0 && !absolute; i--) {
                path = args[i];
                if (typeof path != 'string' || !path) {
                    continue;
                }
                resolvedPath = path + '/' + resolvedPath;
                absolute = path.charAt(0) == '/';
            }

            resolvedPathStr = normalizeArray(S.filter(resolvedPath.split('/'), function (p) {
                return !!p;
            }), !absolute).join('/');

            return ((absolute ? '/' : '') + resolvedPathStr) || '.';
        }
1168463
def fnmatch_pathname_to_regex(pattern):
	
	i, n = 0, len(pattern)
	nonsep = ''.join(['[^', os.sep, ']'])
	res = []
	while i < n:
		c = pattern[i]
		i = i + 1
		if c == '*':
			try:
				if pattern[i] == '*':
					i = i + 1
					res.append('.*')
					if pattern[i] == '/':
						i = i + 1
						res.append(''.join([os.sep, '?']))
				else:
					res.append(''.join([nonsep, '*']))
			except IndexError:
				res.append(''.join([nonsep, '*']))
		elif c == '?':
			res.append(nonsep)
		elif c == '/':
			res.append(os.sep)
		elif c == '[':
			j = i
			if j < n and pattern[j] == '!':
				j = j + 1
			if j < n and pattern[j] == ']':
				j = j + 1
			while j < n and pattern[j] != ']':
				j = j+1
			if j >= n:
				res.append('\\[')
			else:
				stuff = pattern[i:j].replace('\\', '\\\\')
				i = j+1
				if stuff[0] == '!':
					stuff = ''.join('^', stuff[1:])
				elif stuff[0] == '^':
					stuff = ''.join('\\' + stuff)
				res.append('[{}]'.format(stuff))
		else:
			res.append(re.escape(c))
	res.insert(0, '(?ms)')
	res.append('\Z')
	return ''.join(res)
429074
def match_to_key(match, path, location)
      key   = super
      scope = match[1]
      if scope
        scope_parts = extract_literal_or_array_of_literals(scope)
        return nil if scope_parts.nil? || scope_parts.empty?
        "#{scope_parts.join('.')}.#{key}"
      else
        key unless match[0] =~ /\A\w/
      end
    end
846388
def get_formatted_path(path):
        
        if path[0] != '/':
            path = '/' + path
        if path[-1] != '/':
            path = '{0}/'.format(path)
        return path
192108
function matchPath(a, b) {
        var regex = new RegExp('^' + a.join('~~'), 'i');
        return regex.test(b.join('~~'));
    }
1129260
function tokensToRegExp (tokens, keys, options) {
  if (!isarray(keys)) {
    options = /** @type {!Object} */ (keys || options);
    keys = [];
  }

  options = options || {};

  var strict = options.strict;
  var end = options.end !== false;
  var route = '';

  // Iterate over the tokens and create our regexp string.
  for (var i = 0; i < tokens.length; i++) {
    var token = tokens[i];

    if (typeof token === 'string') {
      route += escapeString(token);
    } else {
      var prefix = escapeString(token.prefix);
      var capture = '(?:' + token.pattern + ')';

      keys.push(token);

      if (token.repeat) {
        capture += '(?:' + prefix + capture + ')*';
      }

      if (token.optional) {
        if (!token.partial) {
          capture = '(?:' + prefix + '(' + capture + '))?';
        } else {
          capture = prefix + '(' + capture + ')?';
        }
      } else {
        capture = prefix + '(' + capture + ')';
      }

      route += capture;
    }
  }

  var delimiter = escapeString(options.delimiter || '/');
  var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;

  // In non-strict mode we allow a slash at the end of match. If the path to
  // match already ends with a slash, we remove it for consistency. The slash
  // is valid at the end of a path match, not in the middle. This is important
  // in non-ending mode, where "/test/" shouldn't match "/test//route".
  if (!strict) {
    route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  }

  if (end) {
    route += '$';
  } else {
    // In non-ending mode, we need the capturing groups to match as much as
    // possible by using a positive lookahead to the end or next path segment.
    route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  }

  return attachKeys(new RegExp('^' + route, flags(options)), keys)
}
529468
def find_best_match(path, prefixes):
    """"""
    path_parts = path.split('.')
    for p in prefixes:
        if len(p) <= len(path_parts) and p == path_parts[:len(p)]:
            return '.'.join(p), '.'.join(path_parts[len(p):])
    return '', path
301068
function matches (path) {
      if (type(ignores) === TYPES.STRING) {
        return path.search(ignores) > -1;
      } else if (type(ignores) === TYPES.REGEXP) {
        return ignores.test(path);
      } else {
        return ignores.some(function (ignore) {
          return type(ignore) === TYPES.STRING ? (path.search(ignore) > -1) : ignore.test(path);
        });
      }
    }
464542
def match(path)
       if match = @regexp.match(path)
         params = {}
         @named.each_with_index { |name, i| params[name] = match[i + 1] } if @type == :handlers
         {
             path: path,
             title: self.flags.fetch(:title){nil},
             params: params,
             route: self
         }
       else
         false
       end
    end
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;
}