mtrpcic/pathjs — pull request #39 by sfoster (2012-08-26 21:36:40+00:00)
Title: Errors in path matching in paths with repeated substrings

I ran into an issue where I was expecting #/world/world/1,2 to be matched by my route #/world/:region/:coord and it wasn't. I tracked this down to the string substitution block in the 'match' method. I ended up reimplementing this block using a simple regexp and a loop through the string.

I've updated the unit tests to add a failing test case that is fixed by this change. I'm not particular about the exact implementation, just the result. I've also created a couple of fiddles to demonstrate the problem, and the fix in action:

Using original path.js: http://jsfiddle.net/sfoster/35Dxv/
Using the patched path.js http://jsfiddle.net/sfoster/UMPy2/