Docs · Validators
regex validator
Match a value against a JavaScript-flavour regular expression.
Reference
Format
Accepts any value matched by `new RegExp(pattern).test(value)`. The pattern is interpreted by V8/Node — JavaScript regex syntax, not PCRE. No flags are applied (no `i`, no `u`); embed them in the pattern with `(?i)` is NOT supported — use a character class like `[Aa]` or pre-uppercase in your transform.
Examples
- pattern: '^[A-Z]{3}-\\d{4}$' // SKU-1234
- pattern: '^756\\.\\d{4}\\.\\d{4}\\.\\d{2}$' // Swiss AHV
- pattern: '^\\d{5}(-\\d{4})?$' // US ZIP
How it runs
Implementation
Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.
function validRegex(value, params) {
if (typeof params.pattern !== 'string') {
return fail('regex_misconfigured', 'pattern not provided')
}
return new RegExp(params.pattern).test(value)
? OK
: fail('regex_mismatch', `does not match ${params.pattern}`)
}Config
Use in a template
Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.
fields:
- column: sku
type: string
validators:
- type: regex
pattern: '^[A-Z]{3}-\d{4}$'Watch out
Common gotchas
- JavaScript-flavour only. Lookbehind is fine on Node 20+, but POSIX classes like [[:alpha:]] are not.
- No implicit anchors — write `^…$` yourself or the pattern will match substrings.
- Empty values bypass all validators by design. Pair `required: true` with regex if you want to reject blanks.
Catalogue
Related templates
- Employee roster
employee_roster_v1Names, AHV/GLN, contract type, address.
Fields:
ahv_number - Patient demographics
patient_demographics_v1Patient identity. Emits FHIR Patient.
Fields:
ahv_number - Payments
payments_v1Masked card payments: brand, last 4 digits, amount, processor reference. PCI scope — full PAN must NEVER be imported, only the last 4 digits.
Fields:
card_last4 - KYC profiles
kyc_profiles_v1Know-Your-Customer identity profiles with risk rating. Contains PII.
Fields:
national_id - Employees
employees_v1Employee master records with identity, contact, and bank details. Contains PII.
Fields:
national_id
Pricing
Validators run on every committed row
Validators add no AI cost — they are pure functions. Every map bills a small flat per-map fee from your prepaid token wallet ($10 minimum, shared across our suite); only columns that reach the metered LLM layer, plus any-to-any convert and reshape, bill real AI tokens. See pricing →
Explore
Other validators
Back to the documentation index or browse the template catalogue.
Ready when you are
Validate every row — before it lands.
Attach checksum-strict validators to any field, and gate risky commits with the requires_hitl flag. One key runs the whole cascade.