code: function routeMatcher(route) {
      var segments = route.replace(/^\/+|\/+$/, '').split(/\/+/);
      var names = [];
      var rules = [];
      
      segments.forEach(function(segment){
        var rule;
        if (segment.charAt(0) === ':') {
          names.push(segment.slice(1));
          rules.push('([^\/]+)');
        } else if (segment === '**') {
          names.push('tail');
          rules.push('(.+)');
        } else {
          rules.push(escapeRegExp(segment));
        }
      });
      
      var regex = new RegExp('^\/' + rules.join('\/') + '\/?$', 'i');
      
      var matcher = function(url) {
        var match = url.match(regex);
        if (! match) {
          return;
        }
        
        var result = {};
        names.forEach(function(name, i) {
          result[name] = match[i + 1];
        });
        
        return result;
      };
      
      return matcher;
    }
docs: coded by rumkin