lib/Router.js
/**
 * Turn a string into a RegExp pattern if it has asterisks.
 */
Turn a string into a RegExp pattern if it has asterisks.
Turn a string into a RegExp pattern if it has asterisks .
function patternify(str, start, end) {
  if (typeof str == 'string') {
    str = str.toLowerCase();
    if (str.indexOf('*') > -1) {
      str = str.replace(/\*/g, '@');
      str = str.replace(/([^\d\w_-])/gi, '\\$1');
      str = str.replace(/\\@/g, '.*');
      return new RegExp(start + str + end, 'i');
    }
  }
  return str;
}
function patternify ( str , start , end ) { if ( typeof str == 'string' ) { str = str . toLowerCase ( ) ; if ( str . indexOf ( '*' ) > - 1 ) { str = str . replace ( / \* / g , '@' ) ; str = str . replace ( / ([^\d\w_-]) / gi , '\\$1' ) ; str = str . replace ( / \\@ / g , '.*' ) ; return new RegExp ( start + str + end , 'i' ) ; } } return str ; }
Turn a string into a RegExp pattern if it has asterisks.
Turn a string into a RegExp pattern if it has asterisks .