Skip to content

regexMatcher

const regexMatcher: MatcherFn;

Defined in: matchers.ts:80

Built-in, zero-dep matcher backing the "regex" name out of the box. The query is { pattern: string, flags?: string }; the subject (an attribute value, or the whole context) is coerced with String() and tested against the RegExp. A bad pattern throws → the evaluator fails the condition closed.

Uses the native RegExp, so it needs no dependency. For compile-time-typed patterns you can register your own matcher built on a library like ts-regexp.

// { operator: "matches", matcher: "regex", attribute: "email",
// value: { pattern: "@example\\.com$", flags: "i" } }