matches

Full name: taxi.stdlib.matches

Signature

declare extension function matches(source: String, regex: String): Boolean

Description

Returns true if the entire source string matches the provided regular expression.

Uses full-string matching — the pattern must match the entire string, not just a part of it. Use containsPattern for partial (substring) matching.

find { account: Account } as {
   isValidCode: Boolean = account.code.matches('^[A-Z]{3}-\d{4}$')
}

Examples

Returns true only when the full string matches the regex pattern.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi