EllisLab/CodeIgniter — Issue #658: Routing wildcard :any doesn't work quite as advertised
Author: lambentman
Created: 2011-11-10 00:07:22+00:00
State: open

The User Guide page for URI Routing states:

> You can match literal values or you can use two wildcard types:
>
> (:num) will match a segment containing only numbers.
> (:any) will match a segment containing any character.

This is actually not the case, however; because of the regex used `:any` will potentially match multiple segments.

I suggest that either the regex used to replace `:any` in `system/core/Router.php` be changed from

$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));

to

$key = str_replace(':any', '[^/]+', str_replace(':num', '[0-9]+', $key));

to force `:any` to match only a single segment or that the User Guide be updated to read:

> You can match literal values or you can use two wildcard types:
>
> (:num) will match a segment containing only numbers.
> (:any) will match any number of segments containing any characters.