Input node validation with regular expressions
Input nodes can validate customer input using regular expressions (regex). This ensures you collect correctly formatted data.
Common validation patterns
- Email address –
^[\w.%+-]+@[\w.-]+\.[\w]{2,}$ - Serial number (format SN-1234-5678) –
^SN-\d{4}-\d{4}$ - Phone number (US) –
^\(\d{3}\) \d{3}-\d{4}$or^\+1\d{10}$ - Order ID (ORD-xxxxx) –
^ORD-[A-Z0-9]{5}$ - IP address –
^(\d{1,3}\.){3}\d{1,3}$ - Date (YYYY-MM-DD) –
^\d{4}-\d{2}-\d{2}$ - ZIP/Postal code (US) –
^\d{5}(-\d{4})?$ - Alphanumeric only –
^[a-zA-Z0-9]*$
Setting up validation
- Click the Input node to open properties.
- In the Validation pattern field, enter your regex pattern.
- In the Validation message field, enter a friendly error message (e.g., 'Please enter a valid email address, like name@example.com').
- Toggle Required on if the field is mandatory.
- Save the node.
How validation works
When the customer enters text and clicks Continue:
- The input is tested against the regex pattern.
- If it matches, the customer proceeds.
- If it does not match, an error message appears below the input field. The customer cannot proceed until they correct the input.
- Empty input passes validation only if Required is OFF.
Testing your regex
Use online regex testers (regex101.com) or the console in browser DevTools to test patterns before saving.
Certorix uses JavaScript regex engine (ECMAScript). Features like lookahead/lookbehind are supported.
Example with seral number
Pattern: ^SN-\d{4}-\d{4}$
Validation message: 'Serial number must be in format SN-1234-5678'
Valid: SN-0001-9999, SN-1234-5678
Invalid: SN-123-4567, SN-12345-6789, SN-ABCD-1234
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article