I've successfully created my Route using Regex. I have Several Optional Parameters in my route that I don't want displayed in the URL Helper unless the user has specified them. How can I accomplish this?
This is what I currently have
        $route = new Zend_Controller_Router_Route_Regex(
        '([a-zA-Z-_0-9-]+)-Widgets(?:/page/(\d+))?(?:/limit/(\d+))',
        array(
            'controller'    => 'widget',
            'action'        => 'list',
        ),
        array(
            1 => 'color',
            2 => 'page',
            3 => 'limit'
        ),
        '%s-Widgets/'
    );
    $router->addRoute('color_widgets', $route);
I then call the URL Helper with following code
        echo $this->url(array('page' => $page), 'color_widgets', false); 
This results in /Blue-Widgets/ and does not send the Page to the URL. I can fix this by changing the reverse in the Router
    $route = new Zend_Controller_Router_Route_Regex(
        '([a-zA-Z-_0-9-]+)-Widgets(?:/page/(\d+))?(?:/limit/(\d+))',
        array(
            'controller'    => 'widget',
            'action'        => 'list',
            'page'      => 1
        ),
        array(
            1 => 'color',
            2 => 'page',
            3 => 'limit'
        ),
        '%s-Widgets/page/%d'
    );
However this doesn't solve my problem say I have a Url
/Blue-Widgets/page/1/limit/10 The limit doesn't show, again I can fix that with the following
    $route = new Zend_Controller_Router_Route_Regex(
        '([a-zA-Z-_0-9-]+)-Widgets(?:/page/(\d+))?(?:/limit/(\d+))',
        array(
            'controller'    => 'widget',
            'action'        => 'list',
            'page'      => 1,
            'limit'     => 10
        ),
        array(
            1 => 'color',
            2 => 'page',
            3 => 'limit'
        ),
        '%s-Widgets/page/%d/limit/%d'
    );
The problem with this is the user is at /Blue-Widgets/ and I want to take them to the next page of Blue Widgets with following code
        echo $this->url(array('page' => $page), 'color_widgets', false); 
They are actually taken to /Blue-Widgets/page/2/limit/10
When I actually want to take them to /Blue-Widgets/page/2
How can I accomplish this with the Zend Framework.
 
     
    