code: function getTokenValuesFromUrl(pattern, url) {
      var tokenValues = {},
          urlSegments = url.split('/');
  
      pattern.split('/').forEach(function (segment, idx) {
  
          // this has this form {stuff}, so let's dig
          var beginIdx = segment.indexOf('{');
          var endIdx = segment.indexOf('}');
          var endLen = segment.length - endIdx - 1;
          var urlSegment = urlSegments[idx];
  
          if (beginIdx > -1) {
  
              // peel off the { and } at the ends
              segment = segment.substring(beginIdx + 1, endIdx);
  
              var pieces = segment.split(':');
              if (pieces.length === 2 && pieces[1] === urlPathPatternSymbol ) {
                  var vals = [urlSegment.substring(beginIdx, urlSegment.length - endLen)];
                  for ( var i = idx + 1, len = urlSegments.length; i < len; i++ ) {
                      vals.push(urlSegments[i]);
                  }
                  tokenValues[pieces[0]] = vals.join('%20'); // join any remaining segments with a space
              }
              else if (pieces.length === 2 || pieces.length === 1) {
                  tokenValues[pieces[0]] = urlSegment.substring(beginIdx, urlSegment.length - endLen);
              }
          } // else no token to grab
      });
  
      return tokenValues;
  }
docs: Use a given pattern to extract tokens from a given URL
  @param pattern
  @param url
  @returns {{}}