joshbuddy/sherpa — pull request #12 by donaldr (2011-11-22 21:05:29+00:00)
Title: Issues with multiple matchesWith

I have a route that looks like the following:

http://my_site/my_lookup/:my_first_variable/:my_second_variable

I found that

Route.add(/my_lookup/:my_first_variable/:my_second_variable, {matchesWith: {my_first_variable: /this|that/, my_second_variable: /other|things/}}).to('my_route');

didn't work. After investigating the source I found that I could make it work like so:

Route.add(/my_lookup/:my_first_variable/:my_second_variable, {matchesWith: {my_first_variable: /this\/|that\//, my_second_variable: /other|things/}}).to('my_route');

However, that would then return variables with the slashes. The first line seems like the correct one. Am I doing something incorrectly? The documentation isn't explicit enough to cover this case, and the tests don't cover it either.

Donny.