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
| Field | Type | Description |
|---|---|---|
min_length | Integer | Minimum number of characters allowed. |
max_length | Integer | Maximum number of characters allowed. |
regex | String | Regular 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": ""
}Updated 10 days ago
Did this page help you?
