laughinghan/choreographer — pull request #11 by gsf (2012-07-06 18:34:27+00:00)
Title: Use + to avoid * replacement

Great library!

For a route like `'/**'` I was getting a regex like `RegExp('^/(.([^/]*))$')` so I dug in and found this:

route = new RegExp('^' + //and everything else matches literally
String(route)
.replace(specialChars, '\\$&')
.replace(/\*\*/g, '(.*)')
.replace(/\*/g, '([^/]*)') +
'$',

The second replace takes care of the two stars, but the third replace then replaces the star in the second replace.

The fix I've proposed here is to use plus signs instead of stars in our generated regex. By doing so I've changed the behavior slightly, so people who rely on `'/item/*'` to catch both `/item/123` and `/item/` will be upset.