Guided Conversation Regex Validation

The Collect Info and Form cards make it easy to collect data from Concierge users. Sometimes that data should be collected in a specific format, like as a phone number, or as an email.

The new Regex (regular expression) validation option provides an incredibly powerful and flexible method of validating the collected info. When a bot user enters the information, the regular expression checks if their input matches the desired format. If the format is incorrect, the bot will return the specified error message and request the user re-enter the information.


Important Form Card Validation Notes

  • Form card validation will only work if the collection step has a defined “variable”.
  • At this time, form cards will only show the first error encountered.
  • Users will have to re-enter their form information when an error occurs.

What is Regex?

Regex is short for regular expression. A regular expression is a sequence of characters that specifies a pattern to which a text string should be matched. If all of that sounds confusing, don’t worry, you’re in good company.

In layman’s terms, a regex can be used to check if some text matches the format defined by the regular expression. People familiar with regex can build their own very specific validation. For the rest of us, we’re happy to provide common examples that can be copy pasted by any user.

Common Regex Expressions

Copy the expressions below to use them for validation.

Email 
^[_]*([a-z0-9]+(\.|_*)?)+@([a-z][a-z0-9-]+(\.|-*\.))+[a-z]{2,6}$

Phone number 
^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$

Positive number
^\d*\.?\d+$

Negative number
^-\d*\.?\d+$


Was this article helpful?