Looking to collect US zip codes and validate that the entries are correct? Here's how!
- Click Question at the bottom of the page where you wish to add your zip code question.
- Select Textbox from the Question Type dropdown menu and enter your question text.
- Next, head over to the Validation tab and select RegEx in the Answer Format dropdown menu.
- In the Common Patterns dropdown menu that appears after selecting Regex, select US Zip Code 5 or 9 digit (w/ dash). This will populate with the RegEx Validation field with pattern that will validate that your respondents enter either a 5-digit US Zip Code or a 9-digit US Zip Code with a dash.
- Finally, enter the message you wish to display if the survey respondent's entry does not pass your RegEx validation rules.
What if I wish to allow 5-digit zip codes only?
You can do this! To do so follow steps 1-3 above. Then, instead of selecting from the Common Patterns dropdown menu simply paste the below code in to the RegEx Validation field. Finish by entering the message you wish to display if the survey respondent's entry does not pass your RegEx validation rules.