The Regular Expression (Regex) question type allows you to build a question with restrictions on responses. For example, you can require that users enter a response in a specific format, or within a certain numeric range.
The Regex question type is available with the Standard +2 or Advanced license. Reach out to Support to enable this question type in your site or if you have any questions related to using it.
There are two key components when building a Regex question:
- In order to define the response restrictions, you'll need to enter a Validation Expression.
-
- For example, the following expression would restrict responses to $0-1500 with any amount of 0s in front: ^0*([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|1[0-4][0-9][0-9]|1500)$
- The Validation Error Message allows you to enter text that will appear in a red box underneath the question if a user enters something that doesn't meet the restrictions.
After the Regex question is created, it will appear on the form as a text box.
Regex questions cannot be shared to another form in the process.
Validation Expression Resources
If you need assistance with writing a validation expression, reach out to Support.
There are also a variety of resources online if you'd like to learn more or want to write your own validation expression. Some resources that others have found helpful are listed below:
- Building regular expressions: https://www.codeproject.com/articles/9099/the-30-minute-regex-tutorial
- Testing regular expressions: https://regexr.com/