match
Checks if the value matches the given regular expression
V::match($value, string $pattern): bool
Parameters
Name | Type | Default |
---|---|---|
$valuerequired | mixed |
no default value |
$patternrequired | string |
no default value |
Return type
bool
In your code
if (V::match($value, '/[a-z0-9]+/')) {
echo 'Yay, valid!';
}
In fields
fields:
example:
label: Example field
type: text
validate:
match: "/[a-z0-9]+/"