How to: Regex validation in routes segments?

In Django I can define links like that:

url(r'^forum/(?P<forum_slug>[\w\d-]+)-(?P<forum_id>\d+)/$', ForumView.as_view(), name='forum')

This produces fancy “forum/support-requests-41/” link, Django will find valid view and render me list of threads.

…then Ember.js will start and it will produce me 404 page cos I have no idea how to write such route in Ember.js.

Is this possible? Are there any exameples of such routes in ember.js?

I’ve came to conclusion that this isn’t one problem but two:

First, I’ll need to write custom segment serializer/deserializer that will extract id from thread-slug-id, as well as produce thread-slug-id from model. Thankfully there are hooks in routes for doing this.

Second, I’ll need way to validate within my routes that this special segment matches certain regex. How can this be done?

What is this validation doing? Preventing the transition from happening if it doesn’t match the regex? Redirecting the user somewhere else?

I would like Router to keep matching until it reaches *catch-all route that will display 404 page.

I couldn’t find documentation for this.route() that are used to define routes in, so I’ve looked up source and it looks like there’s no option to do this. Looks like I’ll have to implement custom feature to router.