I might be missing something obvious here, but I’m trying to define a route in NancyFx that uses multiple regex capture groups.
Get[@"/campaign/(?<campaignid>[0-9]{1,8})/console(?<page>[0-9])/(?<personid>[0-9]{1,8})"]
The regex works in the regex tester against URL’s like /campaign/12345/console1/123 but in Nancy I always get 404.
If I chop it down I get back to Get[@"/campaign/(?<campaignid>[0-9]{1,8})/console"] at which point it works, making me think that the problem might be having more than one named group. Is this meant to work, by design?
Technically what you are experience is a (new) bug that is happening because your middle capture group has a string literal in front of it. I’ll have a look at that for the next, release which is just around the corner.
Fortunately there is an easy work around, just update your path so it looks like this
@"/campaign/(?<campaignid>[0-9]{1,8})/(?:console(?<page>[0-9]))/(?<personid>[0-9]{1,8})"And this will trick Nancy a bit, but not capture the
consolepart 🙂