(12-14-2023, 03:47 AM)bgeneto Wrote: Quote:With regular expressions, you can also catch a segment containing a forward slash (/), which would usually represent the delimiter between multiple segments.
For example, if a user accesses a password protected area of your web application and you wish to be able to redirect them back to the same page after they log in, you may find this example useful:
PHP Code:
<?php
$routes->get('login/(.+)', 'Auth::login/$1');
But that's not the case, unless you rely on variable-length argument lists, i.e., multiple arguments.
I have re-read the user guide and this description and the current behavior still do not match.
It is natural that the string that matches
(.+) would be the one param
$1.
If we define a route like this:
PHP Code:
$routes->get('products/([a-z]+)/(.+)', 'Products::show/$1/id_$2');
and navigate to the URI
products/shirts/123/456, the controller method parameters would be like:
Code:
$params array (3)
⇄0 => string (6) "shirts"
⇄1 => string (6) "id_123"
⇄2 => string (3) "456"
It seems to me that the current behavior should be changed.