5.5. Variable requirements
Prev | Chapter 5. Zend_Controller_RewriteRouter | Next

## 5.5. Variable requirements

One can add a fourth parameter where variable requirements can be set. These are defined as regular expressions:

    $router->addRoute('archive', 'archive/:year', array('year' => 2006), array('year' => '\d+'));

| Note
Unlike Ruby on Rails, ZF RewriteRouter will match a route and use a default when a fourth parameter variable requirement is not met. So the URL of 'http://example.com/archive/test' will match the above route and set the year to 2006. This functionality may be altered in the future as it is being discussed at the moment of writing of this documentation.

Prev | Up | Next
5.4. Variable defaults | Home | 5.6. Base URL and subdirectories