validatePattern

Mask
stable

Run a named or custom validator against an unmasked string. Named validators (e.g. "numeric", "alpha") are looked up in the built-in VALIDATORS registry; unknown names throw to catch typos early.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

unmasked
required
string
The raw value after mask characters have been stripped (output of unmaskValue).
validator
required
TPatternValidator
Either a named validator string (e.g. "numeric", "alpha", "alphanumeric") or a custom (s: string) => boolean function.

API

Return value

The value returned by this util.

true when the unmasked value satisfies the validator, false otherwise.

Usage

Examples

Ready-to-paste usage snippets.

Named and custom validators

typescript