Skip to content

Kirby 3.5.7.1

match

Checks if the value matches the given regular expression

V::match($value, string $pattern): bool

Parameters

Name Type Default
$value * mixed
$pattern * string

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]+/"