docs/vendor/path-to-regexp/index.js
function replacePath (path, keys) {
  var index = 0;

  function replace (_, escaped, prefix, key, capture, group, suffix, escape) {
    if (escaped) {
      return escaped;
    }

    if (escape) {
      return '\\' + escape;
    }

    var repeat   = suffix === '+' || suffix === '*';
    var optional = suffix === '?' || suffix === '*';

    keys.push({
      name:      key || index++,
      delimiter: prefix || '/',
      optional:  optional,
      repeat:    repeat
    });

    prefix = prefix ? ('\\' + prefix) : '';
    capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?');

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

    if (optional) {
      return '(?:' + prefix + '(' + capture + '))?';
    }

    // Basic parameter support.
    return prefix + '(' + capture + ')';
  }

  return path.replace(PATH_REGEXP, replace);
}
function replacePath (path, keys) {
  var index = 0;

  function replace (_, escaped, prefix, key, capture, group, suffix, escape) {
    if (escaped) {
      return escaped;
    }

    if (escape) {
      return '\\' + escape;
    }

    var repeat   = suffix === '+' || suffix === '*';
    var optional = suffix === '?' || suffix === '*';

    keys.push({
      name:      key || index++,
      delimiter: prefix || '/',
      optional:  optional,
      repeat:    repeat
    });

    prefix = prefix ? ('\\' + prefix) : '';
    capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?');

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

    if (optional) {
      return '(?:' + prefix + '(' + capture + '))?';
    }

    // Basic parameter support.
    return prefix + '(' + capture + ')';
  }

  return path.replace(PATH_REGEXP, replace);
}
function replacePath ( path , keys ) { var index = 0 ; function replace ( _ , escaped , prefix , key , capture , group , suffix , escape ) { if ( escaped ) { return escaped ; } if ( escape ) { return '\\' + escape ; } var repeat = suffix === '+' || suffix === '*' ; var optional = suffix === '?' || suffix === '*' ; keys . push ( { name : key || index ++ , delimiter : prefix || '/' , optional : optional , repeat : repeat } ) ; prefix = prefix ? ( '\\' + prefix ) : '' ; capture = escapeGroup ( capture || group || '[^' + ( prefix || '\\/' ) + ']+?' ) ; if ( repeat ) { capture = capture + '(?:' + prefix + capture + ')*' ; } if ( optional ) { return '(?:' + prefix + '(' + capture + '))?' ; } // Basic parameter support. return prefix + '(' + capture + ')' ; } return path . replace ( PATH_REGEXP , replace ) ; }
Replace the specific tags with regexp strings.

@param  {String} path
@param  {Array}  keys
@return {String}
Replace the specific tags with regexp strings .