Validation Regexes

Introduction to Validation Regexes

Some fields returned by the Form Fields API include validation rules to help you validate user input before submitting it to our API.

If a field requires validation, the response includes a validation object containing the supported constraints.

📘

Note:

Not every field includes validation rules. Only fields that require client-side validation will contain the validation object.

Validation Object

FieldTypeDescription
min_lengthIntegerMinimum number of characters allowed.
max_lengthIntegerMaximum number of characters allowed.
regexStringRegular expression the value must satisfy.

Example

{
    "field_key": "receiver_postal_code",
    "field_label": "Address Postal Code",
    "field_type": "string",
    "is_mandatory": false,
    "is_editable": true,
    "validation": {
        "min_length": 4,
        "max_length": 10,
        "regex": "/^[A-Za-z0-9][A-Za-z0-9\\s-]{3,9}$/"
    },
    "category": "Address",
    "values_supported": [],
    "children": [],
    "is_repeatable": false,
    "field_value": "",
    "parent_key": "",
    "required_if_empty_of": "",
    "required_if": ""
}

Did this page help you?