Platform
Chatbot Builder Bulk Messaging Team Inbox Mini CRM API & Webhooks AI Integration WhatsApp Flows
Industries
E-commerce & D2C Real Estate Education Healthcare Finance & BFSI Logistics Hospitality Retail
Integrations
Learn
Learning Hub Help & Docs Connect Guides Automation Codex Blog Message Templates
Pricing Get Started →
HomeHelp & DocsBot Builder › Validate user replies with regex in a bot flow
Bot Builder

Validate user replies with regex in a bot flow

When you ask a user a question in a bot flow, they might type anything. Regex (regular expression) validation lets you specify the exact format a reply must match — a 10-digit phone number, a 6-digit OTP, a 2-digit age, or an email address — and reject any reply that does not match before continuing the flow.

Add regex validation to a question

1
In your bot flow, open or add an Ask a Question block.
2
Set the question type to Text (not buttons or interactive).
3
Scroll to the Validation section of the block.
4
Enable validation and select Regex as the validation type.
5
Enter your regex pattern in the pattern field.
6
Enter a validation error message — this is sent to the user when their reply does not match (e.g., 'Please enter a valid 10-digit mobile number').
7
Set how many times the bot should retry before giving up or routing elsewhere.
8
Save the block.

Common regex patterns

Copy any of these into the validation field:

10-digit Indian mobile number: /^[6-9]\d{9}$/ 6-digit OTP: /^\d{6}$/ 2-digit number: /^\d{2}$/ Email address: /^[\w.-]+@[\w.-]+\.[a-z]{2,}$/ Date (DD/MM/YYYY): /^\d{2}\/\d{2}\/\d{4}$/ Pincode (India, 6 digits): /^[1-9][0-9]{5}$/
Generate regex with AI

Not sure how to write a pattern? Use the Regex Creator GPT — describe what you need in plain English and it generates the pattern for you.

Was this helpful? If you are stuck, message us and a real person will help — the only platform that answers you live on WhatsApp.

Ask us on WhatsApp
Related guides
1