Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Matching route that doesn't contain some word

How to do it ? Currently i have those routes in my application:

        $this->addGet('/poradnik/tag/{tagName}', array('action'=>'tag','controller'=>'index'));
        $this->addGet('/poradnik/{categoryName:(?<!\.tag)$}/{title}', array('action'=>'article','controller'=>'index')); // this doesn't work, 404

I had to do

$this->addGet('/poradnik/{categoryName}/{title}', array('action'=>'article','controller'=>'index'));

And check in action if categoryName is tag then forward to tag action. How to make working regex ?



99.6k
Accepted
answer

Well I just changed it to:

        $this->addGet('/poradnik/{categoryName}/{title}', array('action'=>'article','controller'=>'index'));
        $this->addGet('/poradnik/tag/{tagName}', array('action'=>'tag','controller'=>'index'));

And it's working. So obvious