Create keys from match groups in the given regex
@param  {!RegExp} path
@param  {Array=}  keys
@return {!RegExp}
484669
function regexpToRegexp(regex, keys, options) {
  if (!Array.isArray(keys)) return regex.source;

  let groups = regex.source.match(/\((?!\?)/g);
  if (!groups) return regex.source;

  let i = 0;
  let group = () => ({
    name: i++,
    prefix: null,
    delimiter: null,
    optional: false,
    repeat: false,
    partial: false,
    pattern: null
  });

  groups.forEach(() => keys.push(group()));
  return regex.source;
}
1038195
function keysIndexes(children, startIndex, endIndex) {
  var i, keys = Object.create(null), key;
  for (i = startIndex; i <= endIndex; ++i) {
    if (children[i]) {
      key = children[i].key;
      if (key !== undefined) {
        keys[key] = i;
      }
    }
  }
  return keys;
}
87798
function extractPaths(obj, newKeys, ...paths) {
  const nkLen = newKeys.length;
  const pLen = paths.length;

  const curried = curry(assignKeysAtPaths, obj, newKeys, paths);

  return nkLen > pLen ? curried(nkLen) : curried(pLen);
}
286056
def read_keys_file(path)
      return [] unless File.exists?(path)
      File.readlines(path).map! { |l| l.chomp.strip }
    end
500370
protected function getKeys($path, array $keys)
    {
        if (!$this->has($path)) {
            return false;
        }

        $return = [];
        foreach ($keys as $key) {
            if ($key === 'path') {
                $return[$key] = $path;
                continue;
            }

            $return[$key] = $this->storage[$path][$key];
        }

        return $return;
    }
171296
function buildRegExps(basePath, dirPaths) {
  return dirPaths.map(folderPath =>
    // Babel cares about windows/unix paths since v7b44
    // https://github.com/babel/babel/issues/8184
    // basePath + path.sep + dirPath/dirRegex
    // /home/name/webroot/js + / + relative/path/to/exclude
    // c:\home\name\webroot\js + \ + relative\path\to\exclude
    folderPath instanceof RegExp
      ? new RegExp(
          `^${escapeRegExp(path.resolve(basePath, '.') + path.sep)}${
            folderPath.source // This is actual regex, don't escape it
          }`,
          folderPath.flags,
        )
      : new RegExp('^' + escapeRegExp(path.resolve(basePath, folderPath))),
  );
}
491810
function (name, paths) {
    
    var patternBits = name.split("-");
    
    var i = 1;
    var c = patternBits.length;
    
    var patternType = patternBits[0];
    while ((paths[patternType] === undefined) && (i < c)) {
      patternType += "-"+patternBits[i];
      i++;
    }
    
    var pattern = name.slice(patternType.length+1,name.length);
    
    return [patternType, pattern];
    
  }
822258
function extendSourceKeys(sourceKeys, source, regexp) {
    for (var key in source) {
        if (!regexp || regexp.test(key)) {
            sourceKeys[key] = key;
        }
    }
}
1234031
function init() {
  var keys = ['\\\\', '\\[', '\\]']
  var key

  for (key in groff) {
    keys.push(key)
    escapes[key] = groff[key]
  }

  return new RegExp(keys.sort(longest).join('|'), 'g')
}
788885
def keys_by_file(path)
      begin
        # Load strings file contents
        strings = read_strings_file(path)

        # Reject generated identifiers used by Interface Builder
        strings.reject! { |key, _| /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{2,3}-[a-zA-Z0-9]{3}/.match(key) }

        keys = Hash[strings.map do |key, value|
          [key, { value: key, comment: value.gsub(/[\r\n]/, ' ') }]
        end]

        log 'Found %s keys in file %s', keys.count, path

        keys
      rescue ArgumentError => error
        raise ArgumentError, 'Error while reading %s: %s' % [path, error]
      end
    end
97755
function (path) {
            // edge case
            if (!path) {
                return [];
            }

            // first letter will give the type
            var first = path.charAt(0), closing, part, next, nextParse;

            // case brackets
            if (first == "[") {
                closing = path.indexOf("]");
                if (closing != -1) {
                    part = path.substring(1, closing);
                    next = path.substring(closing + 1);
                    if (/^\d+$/.test(part)) {
                        nextParse = this._paramParse(next);
                        nextParse.unshift(parseInt(part, 10));
                        return nextParse;
                    } else {
                        // check that part is "something" or 'somethingelse'
                        var strMarker = part.charAt(0), utilString = ariaUtilsString;
                        if ((strMarker == "'" || strMarker == '"')
                                && utilString.indexOfNotEscaped(part, strMarker, 1) == part.length - 1) {
                            nextParse = this._paramParse(next);
                            nextParse.unshift(part.substring(1, part.length - 1).replace(new RegExp("\\\\" + strMarker, "gi"), strMarker));
                            return nextParse;
                        }
                    }
                }
            } else if (first == ".") {
                part = /^[_A-z\$]\w*/.exec(path.substring(1));
                if (part.length) {
                    part = part[0];
                    next = path.substring(part.length + 1);
                    nextParse = this._paramParse(next);
                    nextParse.unshift(part);
                    return nextParse;
                }
            }

            // nothing returned -> throws an exception
            throw {
                error : this.WRONG_PATH_SYNTAX,
                args : [path]
            };
        }
217351
function arrayToRegexp(arr, keys, options) {
  let parts = [];
  arr.forEach(ele => parts.push(toRegexpSource(ele, keys, options)));
  return new RegExp(`(?:${parts.join('|')})`, flags(options));
}
135657
def _extract_path_parameters_from_paths(paths):
    
    params = set()
    for path in paths:
        parts = PART_REGEX.split(path)
        for p in parts:
            match = PARAM_REGEX.match(p)
            if match:
                params.add(match.group("name"))
    return params
366373
function stringToRegexp (path, keys, options) {
	  var tokens = parse(path)
	  var re = tokensToRegExp(tokens, options)
	
	  // Attach keys back to the regexp.
	  for (var i = 0; i < tokens.length; i++) {
	    if (typeof tokens[i] !== 'string') {
	      keys.push(tokens[i])
	    }
	  }
	
	  return attachKeys(re, keys)
	}
1275671
function extractPathParams(pattern, path) {
    const regex = new RegExp(pattern);
    const matches = regex.exec(path);
    if (!matches) {
        return [];
    }
    else {
        const groups = [...matches];
        // remove first result since its not a capture group
        groups.shift();
        return groups;
    }
}
739209
public static List<String> getCamelKeys(String pattern) {
        List<String> keys = new ArrayList<String>();
        for (String s : getOriginalKeys(pattern)) {
            keys.add(StringUtil.underlineToCamel(s));
        }
        return keys;
    }
53259
public static Map<String, List<Map<String, Object>>> nest(Map<String, Object> map, String... keys) {
        Map<String, List<Map<String, Object>>> result = new HashMap<String, List<Map<String, Object>>>(keys.length);
        String keyMatch = "";
        for (String key : keys) {
            result.put(key, new ArrayList<Map<String, Object>>());
            keyMatch = MessageFormat.format("{0}{1}|", keyMatch, Pattern.quote(key));
        }
        String patternString = MessageFormat.format("^({0})\\.([0-9]*)\\.(.*)", keyMatch.substring(0, keyMatch.length() - 1));
        Pattern pattern = Pattern.compile(patternString);
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            String k = entry.getKey();
            Matcher matcher = pattern.matcher(k);
            if (matcher.matches()) {
                int base = 1;
                String key = matcher.group(1);
                processMatch(result.get(key), entry.getValue(), matcher, base);
            }
        }
        return result;
    }