Str::match()
Match string against a regular expression and return matches
Str::match(string $string, string $pattern, int $flags = 0, int $offset = 0): array|null
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $stringrequired | string |
no default value | The string to match |
| $patternrequired | string |
no default value | The regular expression |
| $flags | int |
0
|
Optional flags for PHP preg_match() |
| $offset | int |
0
|
Positional offset in the string to start the search |
Return types
arrayornull
The matches or null if no match was found