Is possible to aply regex to a named parameter in a route? I have a name parameter for lang( /es, /en, etc...) and i want to force to only get the param if it has 2 letters(\w{2}), but I dont see it in docs:
That is not supported by the route syntax, but as a route is a regex, you can add your own. A route like ":lang" is replaced by "(?P<lang>.+?)", so you need to replace the ".+" with your custom regex.
You can do a
Debug::dump(Router::$routes)
to check what route objects are generated from your routes. Each route object has a "translation" property containing the regex that is used to match the route.