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.
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.
Validation Expression Resources
If you need assistance with writing a validation expression, reach out to Support (email@example.com).
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:
- Resource on building regular expressions: https://www.codeproject.com/articles/9099/the-30-minute-regex-tutorial
- Resource for testing regular expressions: https://regexr.com/