name: op-synth-regex
description: String samples generated from a Perl/RE2 regex pattern, with open-ended repeats capped at max_repeat.
kind: operator
category: SYNTH
operator: regex
type: reference
applies_to: inspect, predict, manifest
examples_tags: [synth, data-quality]
Synth distributions emit per-row values; no Response.Components. No MCP tool runs synth: the CLI (pulse synth from-schema) or Pulse.Synth does (synthetic-data).
Use when
Generates text matching a pattern, such as order codes like AB-1234, for realistic-looking IDs and labels.
Questions it answers:
- How do I generate postcodes that look real?
- How do I fill a SKU field with codes like SKU-00042?
Use something else:
weighted_categoricalwhen the values come from a short known list.monotonic_fromwhen IDs must be unique.constantwhen every row should carry the same text.
Params
| Name | Type | Default | Description |
|---|---|---|---|
pattern | string | (required) | Non-empty Perl/RE2 source. |
max_repeat | int | 8 | Floored at 1. Bounds unbounded * / + / {m,}. |
Inputs
Field type: — categorical_u8/u16/u32. Distinct generated strings become dictionary entries.
Output
Per-row string matching the pattern: literals copy, character classes draw uniformly, alternations pick a branch, groups and ? / * / + / {m,n} repeat under max_repeat, anchors emit nothing. Stored as the field’s dictionary code.
Contract
- Applies to:
categoricalfields.
Gotchas
- No backreferences (
\1,(?P=name)); invalid pattern →SERVICE_VALIDATIONwith the syntax error. .emits printable ASCII (33–126).- Unbounded
*/+clamps tomax_repeat; bounded{m,n}tomin(n, min + max_repeat). - An empty character class produces no character. More distinct strings than the width holds (256 for
categorical_u8) →PULSE_IMPORT_CATEGORICAL_OVERFLOWat write.