Reference

Guide

V::match()

Checks if the value matches the given regular expression

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

Parameters

Name Type Default Description
$value getkirby.com/docs/reference/objects/asset/alt
$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]+/"

Source code

kirby/src/Toolkit/V.php#L322