Permalink
Browse files

Merge remote branch 'laurie71/master'

  • Loading branch information...
2 parents 8c41feb + c075333 commit 94d06625da61e5b075906ce8c982a0fec5952702 @s3u committed Feb 22, 2011
Showing with 10 additions and 10 deletions.
  1. +10 −10 lib/middleware/resource.js
View
@@ -185,16 +185,16 @@ function normalizePath(path, keys) {
path = path
.concat('/?')
.replace(/\/\(/g, '(?:/')
- .replace(/(\/)?(\.)?:(\w+)(\?)?/g, function(_, slash, format, key, optional) {
- keys.push(key);
- slash = slash || '';
- return ''
- + (optional ? '' : slash)
- + '(?:'
- + (optional ? slash : '')
- + (format || '') + '([^/.]+))'
- + (optional || '');
- })
+ .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional){
+ keys.push(key);
+ slash = slash || '';
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + (optional ? slash : '')
+ + (format || '') + (capture || '([^/]+?)') + ')'
+ + (optional || '');
+ })
.replace(/([\/.])/g, '\\$1')
.replace(/\*/g, '(.+)');
return new RegExp('^' + path + '$', 'i');

0 comments on commit 94d0662

Please sign in to comment.