make comment explanatory of new style

Thanks @rschamp!
This commit is contained in:
Matthew Taylor 2017-05-24 08:51:28 -04:00
parent 87da9f3d8a
commit 79e778af7a

View file

@ -33,8 +33,10 @@ var FastlyConfigMethods = {
}, },
/* /*
* Translate an express-style pattern e.g. /path/:arg/ to a regex * Translate an express-style pattern to regex one in two ways:
* all :arguments become .+? *
* 1. /path/:arg/ all :arg's become .+?
* 2. /path/:arg([regex]) :arg is removed, leaving just /path/([regex])
*/ */
expressPatternToRegex: function (pattern) { expressPatternToRegex: function (pattern) {
pattern = pattern.replace(/(:\w+)(\([^\)]+\))/gi, '$2'); pattern = pattern.replace(/(:\w+)(\([^\)]+\))/gi, '$2');