Merge pull request #1275 from Sadeghi85/develop

segment pattern to match a single segment, also matches UTF-8 segments.
This commit is contained in:
Taylor Otwell 2013-01-05 13:16:03 -08:00
commit b8ed80608f
1 changed files with 3 additions and 1 deletions

View File

@ -76,6 +76,7 @@ class Router {
public static $patterns = array(
'(:num)' => '([0-9]+)',
'(:any)' => '([a-zA-Z0-9\.\-_%=]+)',
'(:segment)' => '([^/]+)',
'(:all)' => '(.*)',
);
@ -87,6 +88,7 @@ class Router {
public static $optional = array(
'/(:num?)' => '(?:/([0-9]+)',
'/(:any?)' => '(?:/([a-zA-Z0-9\.\-_%=]+)',
'/(:segment?)' => '(?:/([^/]+)',
'/(:all?)' => '(?:/(.*)',
);
@ -494,7 +496,7 @@ protected static function match($method, $uri)
// we just did before we started searching.
if (str_contains($route, '('))
{
$pattern = '#^'.static::wildcards($route).'$#';
$pattern = '#^'.static::wildcards($route).'$#u';
// If we get a match we'll return the route and slice off the first
// parameter match, as preg_match sets the first array item to the