I'm having a bit of trouble configuring the following url. I want it to be able to match a pages which start off with a category and then finish with a slug, examples:
/category1/post1/
/category2/post2/
/category3/post3/
/category1/post4/
/category2/post5/
I've tried many different methods with no success... I always get an "is not a valid regular expression" error. This is how I thought it should work:
url(r'^(?P<category1|category2|category3>[\w\-]+)/(?P<slug>[\w\-]+)/$', blog_post, name = 'blog_post'),
I am fairly new to regex and trying to learn so any help on this one with an explanation would be much appreciated :)
category1|category2|category3tocategoryand it'll work.