Merge pull request #1275 from Sadeghi85/develop
segment pattern to match a single segment, also matches UTF-8 segments.
This commit is contained in:
@@ -76,6 +76,7 @@ class Router {
|
|||||||
public static $patterns = array(
|
public static $patterns = array(
|
||||||
'(:num)' => '([0-9]+)',
|
'(:num)' => '([0-9]+)',
|
||||||
'(:any)' => '([a-zA-Z0-9\.\-_%=]+)',
|
'(:any)' => '([a-zA-Z0-9\.\-_%=]+)',
|
||||||
|
'(:segment)' => '([^/]+)',
|
||||||
'(:all)' => '(.*)',
|
'(:all)' => '(.*)',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ class Router {
|
|||||||
public static $optional = array(
|
public static $optional = array(
|
||||||
'/(:num?)' => '(?:/([0-9]+)',
|
'/(:num?)' => '(?:/([0-9]+)',
|
||||||
'/(:any?)' => '(?:/([a-zA-Z0-9\.\-_%=]+)',
|
'/(:any?)' => '(?:/([a-zA-Z0-9\.\-_%=]+)',
|
||||||
|
'/(:segment?)' => '(?:/([^/]+)',
|
||||||
'/(:all?)' => '(?:/(.*)',
|
'/(:all?)' => '(?:/(.*)',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -494,7 +496,7 @@ class Router {
|
|||||||
// we just did before we started searching.
|
// we just did before we started searching.
|
||||||
if (str_contains($route, '('))
|
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
|
// 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
|
// parameter match, as preg_match sets the first array item to the
|
||||||
|
|||||||
Reference in New Issue
Block a user