Welcome Guest, Not a member yet? Register   Sign In
Route not work with regex
#1

I have reoutes with custom placeholder like:

Code:
// route
$routes->addPlaceholder('unique', '([a-z0-9]{40}|all)$');
$routes->addPlaceholder('tab', '(?:^|done|in-progress)$');

$routes->get('(:unique)', 'Pages::browse/$1');
$routes->get('(:unique)/(:tab)', 'Pages::browse/$1/$2');

Code:
// controller
public function browse($o = 'one', $t= 'two')
{
    echo($o);
    echo('<br/>');
    echo($t);
}

When accessed like http://localhost:8080/all
show
Code:
all
two

but when accessed with http://localhost:8080/all/done just show 404.

by edit the route with
Code:
$routes->get('(:unique)/(:any)', 'Pages::browse/$1/$2');
show
Code:
all
done

whats wrong with the regex?
Reply


Messages In This Thread
Route not work with regex - by mylastof - 01-27-2022, 09:10 PM
RE: Route not work with regex - by kenjis - 01-27-2022, 10:01 PM
RE: Route not work with regex - by iRedds - 01-27-2022, 11:43 PM
RE: Route not work with regex - by mylastof - 01-28-2022, 06:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB