code: function convertUrlPatternToRegex(pattern) {
  
      // pattern = pattern.replace(new RegExp('{[a-zA-Z0-9\\-_~]*}', 'gi'), '[a-zA-Z0-9\\-_~]+');
  
      // let's try a different way...
      // first, ui-router doesn't allow use of fwd slash in URL patterns because it's THE separator:
  
      // however. we /do/ sometimes want to be able to capture the rest of a huge url, at least on the server-side
      // case & point, old urls that point to /search/stuff/morestuff/otherstuff
      // so now we have to respect a trailing /search/{term:*}, which just grabs the whole damn tail
  
      var segments = pattern.split('/');
      var convertedSegments = [];
      for ( var i = 0, len = segments.length; i < len; i++ ) {
          var converted = convertUrlSegmentToRegex(segments[i]);
          convertedSegments.push(converted);
          if ( converted === urlPathPattern ) {
              // short-circuit out of this- we mean to capture the rest of the url with this...
              break;
          }
      }
      // more clever, but since we sometimes want to short-circuit, we use the loop instead
      /*
      var convertedSegments = segments.map(function (segment) {
          return convertUrlSegmentToRegex(segment); // so let's just convert each segment separately
      });
      */
      pattern = convertedSegments.join('/');
  
      pattern = pattern.replace(regexSlash, '\\/');
      pattern = '^' + pattern + '$';
      return new RegExp(pattern);
  }
docs: *
  Convert a pattern from the database into a legit regex pattern
  @param pattern