-
Notifications
You must be signed in to change notification settings - Fork 1
Regex
github-actions[bot] edited this page May 12, 2026
·
1 revision
The regex field validates a configuration value against a regular expression. The value must match the pattern for the control to pass. If it does not match, an InvalidValueParameterException is raised.
{ "name": "source.path", "regex": r"^/[a-zA-Z0-9/_\$\.\-]+$" }Validate that source.path starts with / and contains only valid path characters:
{ "name": "source.path", "regex": r"^/[a-zA-Z0-9/_\$\.\-]+$" }Valid:
source:
path: "/landing/prod/customers/2026-05-11" # OKInvalid:
source:
path: "landing/prod/customers" # raises InvalidValueParameterException (no leading /)Error message:
Property 'source.path' (^/[a-zA-Z0-9/$_\.\-]+$) has invalid value 'landing/prod/customers'
regex and validset can be used together on the same field. Both constraints must pass.
{
"name": "source.format",
"validset": ["csv", "json", "parquet"],
"regex": r"^[a-z]+$"
}import yaml
from pyjeb import control_and_setup
from pyjeb.exception import InvalidValueParameterException
controls = [
{ "name": "source", "type": "dict" },
{ "name": "source.path", "regex": r"^/[a-zA-Z0-9/_\$\.\-]+$" },
{ "name": "source.format", "validset": ["csv", "json", "parquet"] },
{ "name": "source.pattern", "default": "*" },
{ "name": "target", "type": "dict" },
{ "name": "target.path" },
{ "name": "target.mode", "default": "append", "validset": ["append", "overwrite"] },
{ "name": "enabled", "type": "boolean", "default": True },
{ "name": "max_retries", "type": "integer", "default": 3 },
{ "name": "threshold", "type": "decimal", "default": 0.95 },
{ "name": "tags", "type": "list", "default": [] },
]
job_config = {
"source": { "path": "landing/prod/customers", "format": "csv" },
"target": { "path": "/bronze/prod/customers" }
}
try:
job = control_and_setup(job_config, controls)
except InvalidValueParameterException as e:
print(e)
# Property 'source.path' (^/[a-zA-Z0-9/$_\.\-]+$) has invalid value 'landing/prod/customers'