

At the time of designing the form, expand the “Data Validation” section below the form field (see screenshot above) and choose Regular Expression from the drop-down.

Say your Google form expects the user to enter their year of birth. Let’s understand this with a real-world example. Think of them as search patterns and every character entered in a form field is matched against that pattern - the form can only be submitted if the patter and the user-input matches. Google Forms makes it relatively easy to add such advanced date validation rules to individual fields through Regular Expressions (or regex or regexp). For instance, if your form is asking for a person’s year of birth, and the applicant’s age should be between 25 and 50, they should only be allowed to enter a number between 19 in the year of birth field. When you are expecting dozens, or even hundreds, of responses in your Google Forms, it is always a good idea to have some rules in place and the respondents’ data be matched against these rules even before they submit the form. The form has been prepared but before you make it live, how would you ensure that candidates have entered data in the correct format? And even if the format is proper, is the data itself valid? Can you add a CAPTCHA to Google forms to prevent spam bots? Can you include a profanity filter to block people from submitting entries that include obscene words?
#GENERATE REGEX FOR NUMBER RANGE CODE#
You have created a form and it has all the standard fields where candidates can fill-in their name, email address, phone number, zip code and other information. Your organization has a few vacant positions and you are planning to use Google Forms to prepare a pre-interview questionnaire for job applicants.

Collection of regular expressions to validate user input in Google Forms quizzes and surveys.
