nl_tokens: PrivateFunction : urlRegexp Takes a route URL with possible placeholders like / contacts / : contactid and prepares a RegEx for later pattern matching when trying to resolve a route
pl_tokens: function urlRegexp ( url , keys , sensitive , strict ) { if ( url . toString ( ) === '[object RegExp]' ) { return url ; } if ( Array . isArray ( <mask> ) ) { url = '(' + url . join ( '|' ) + ')' ; } url = url . concat ( strict ? '' : '/?' ) . replace ( / \/\( / g , '(?:/' ) . replace ( / (\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)? / g , function ( _ , slash , format , key , capture , optional , star ) { keys . push ( { name : key , optional : ! ! optional } ) ; slash = slash || '' ; return '' + ( optional ? '' : slash ) + '(?:' + ( optional ? slash : '' ) + ( format || '' ) + ( capture || ( format && '([^/.]+?)' || '([^/]+?)' ) ) + ')' + ( optional || '' ) + ( star ? '(/*)?' : '' ) ; } ) . replace ( / ([\/.]) / g , '\\$1' ) . replace ( / \* / g , '(.*)' ) ; return new RegExp ( '^' + url + '$' , sensitive ? '' : 'i' ) ; }