Skip to content

Commit d0d4087

Browse files
committed
wip
1 parent 262f014 commit d0d4087

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Web/Documentation/content/1.x/1-essentials/01-routing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ enum AircraftType: string
130130
}
131131
```
132132

133+
### Regex parameters
134+
135+
You may use regular expressions to match route parameters. This can be useful to create catch-all routes or to match a route parameter to any kind of regex pattern. Add a colon `:` followed by a pattern to the parameter's name to indicate that it should be matched using a regular expression.
136+
137+
```php
138+
#[Get('/main/{path:.*}')]
139+
public function docsRedirect(string $path): Redirect
140+
{
141+
// …
142+
}
143+
```
144+
133145
## Generating URIs
134146

135147
Tempest provides a `\Tempest\uri` function that can be used to generate an URI to a controller method. This function accepts the FQCN of the controller or a callable to a method as its first argument, and named parameters as [the rest of its arguments](https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list).

0 commit comments

Comments
 (0)