Error Preg match search route and paginator !

$router->add("/search",array(
    "module"        => "frontend",
    "controller"    => "index",
    "action"        => "search",
));

$router->add("/search/page/([0-9]+)",array(
    "module"        => "frontend",
    "controller"    => "index",
    "action"        => "search",
    'page'          => 1,
));

Here is route .

When search url like this

http://localhost/search?for=test <--- work

http://localhost/search?for=test/page/2 <--- not work because keyword is "test/page/2" and cann't paging .

So how to fix that problem ????

You have the access the routes in the same way they were defined:

/search/page/([0-9]+) accept routes such as /search/page/1 or /search/page/9292