Fixed issue with url pattern matching.

pull/42/merge
Mike Cao 12 years ago
parent ef72548a1a
commit f64774881f

@ -65,7 +65,7 @@ class Route {
$ids = array(); $ids = array();
$char = substr($this->pattern, -1); $char = substr($this->pattern, -1);
$this->pattern = str_replace(')', ')?', $this->pattern); $this->pattern = str_replace(array(')','*'), array(')?','.*?'), $this->pattern);
// Build the regex for matching // Build the regex for matching
$regex = preg_replace_callback( $regex = preg_replace_callback(
@ -84,10 +84,6 @@ class Route {
if ($char === '/') { if ($char === '/') {
$regex .= '?'; $regex .= '?';
} }
// Replace wildcard
else if ($char === '*') {
$regex = str_replace('*', '.+?', $this->pattern);
}
// Allow trailing slash // Allow trailing slash
else { else {
$regex .= '/?'; $regex .= '/?';

Loading…
Cancel
Save