Response Validation Google Forms: Rules, Regex and Examples
Response validation in Google Forms checks answers before submit. See every rule by question type, regex for phone and ZIP codes, and error text tips.
Response validation in Google Forms is a rule you attach to a question so the form refuses an answer that doesnât fit, before the person can submit. To turn it on, open the question, click the three-dot More menu at the bottom right, choose Response validation, pick a rule, and optionally write a custom error message. The rules you can pick depend on the question type: short answer, paragraph, and checkboxes questions each have their own list (Google Docs Editors Help).
This guide covers how to set it up, every rule Google lists, ready-to-paste regular expressions, and the limits worth knowing before you rely on it.
How to add response validation in Google Forms
These steps follow Googleâs own help page, How to set rules for your form:
- Open your form in Google Forms.
- Add a question, or click an existing one.
- Choose the question type to the right of the question title (for example Short answer).
- Click More (the three dots at the bottom right of the question card).
- Click Response validation. A new row of drop-downs appears under the question.
- Pick the type of rule, then the condition, then the value.
- Optional: type a message in the Custom error text field. Responders see it when their answer breaks the rule.
Before you share the form, open the preview, submit a wrong answer on purpose, and check that your error message shows up. Then submit a correct answer and make sure it goes through.
Response validation rules by question type
Google lists different rule sets for each question type (source):
| Question type | Rule | What it does | Example |
|---|---|---|---|
| Short answer | Number | The answer must be a number that meets a condition | A number between 21 and 42 |
| Short answer | Text | The answer must contain (or not contain) certain text, or be an email or URL | Must be in email format |
| Short answer | Length | Sets a maximum or minimum character count | At most 500 characters |
| Short answer | Regular expression | The answer must match (or not match) a pattern | A 10-digit phone number |
| Paragraph | Length | Sets a maximum or minimum character count | At least 200 characters |
| Paragraph | Regular expression | The answer must match (or not match) a pattern | Contains a reference code |
| Checkboxes | Select at least / at most / exactly | Controls how many boxes can be checked | Select exactly 3 options |
Grid questions work a little differently. For a multiple choice grid or checkbox grid, Google offers Require a response in each row and, under More, Limit to one response per column and Shuffle row order. These are settings on the grid rather than entries in the Response validation menu.
If you are still choosing which question type to use in the first place, our guide to different question types in forms explains when each one fits. For rating questions specifically, see how the linear scale in Google Forms works.
Common response validation examples
Email address
Choose Short answer, then Text, then Email. Google Forms will reject anything that isnât in the format [email protected]. Keep in mind this only checks the format. It canât tell you whether the mailbox exists. If bad addresses are costly for you, read our guide on how to validate email addresses, which covers domain and deliverability checks.
A number in a range
Choose Short answer, then Number, then Between, and enter the two limits. This works well for an age, a quantity, or a year. Write the error text so the person knows exactly what to fix, for example âEnter a whole number between 18 and 99.â
A maximum length for an answer
Choose Paragraph (or Short answer), then Length, then Maximum character count. Googleâs own example is limiting an answer to 500 characters. Note that the limit counts characters, not words, so say âcharactersâ in your error text.
Pick exactly N options
Choose Checkboxes, then Select exactly, and enter the number. This is useful for questions like âPick the three features you use most,â where you want the same number of answers from everyone.
Regex examples for Google Forms response validation
The Regular expression rule lets you require a pattern. Pick Matches or Contains (or their negatives), then paste the pattern. The first two patterns below come from Googleâs help page; the others are common patterns you should test in preview before you go live.
| What you want | Pattern | Accepts | Rejects |
|---|---|---|---|
| 10-digit phone number | [0-9]{10} | 1234567890 | 123-456-7890 |
| US ZIP code (with optional +4) | [0-9]{5}(-[0-9]{4})? | 12345, 12345-6789 | 1234 |
| Answer that starts with a lowercase letter | ^[a-z].* | bob | Bob |
| Email from one company domain | ^[A-Za-z0-9._%+-]+@yourcompany\.com$ | [email protected] | [email protected] |
| Order code like AB-1234 | ^[A-Z]{2}-[0-9]{4}$ | AB-1234 | ab1234 |
Two rules from Googleâs regular expression reference save a lot of confusion (source):
^anchors the start of the answer and$anchors the end. Without them, a pattern can match part of a longer answer.- Characters that mean something in regex, such as
.or$, need a backslash in front when you mean the literal character. Thatâs why the company email pattern uses\.com.
Writing a custom error message that helps
Google Forms lets you write your own error text for every rule. A generic error tells people they are wrong, but not what to do. Good error text names the expected format and gives an example:
- Instead of âInvalidâ, write âEnter your phone number as 10 digits, no spaces (for example 5551234567).â
- Instead of âWrong formatâ, write âUse your work email ending in @yourcompany.com.â
- Instead of âToo longâ, write âKeep your answer under 500 characters.â
Limits of response validation in Google Forms
- Not every question type has it. Googleâs help page lists rules for short answer, paragraph, and checkboxes questions, plus the grid settings above. Multiple choice and drop-down questions already limit people to the options you give, so they donât need it.
- Format is not truth. A valid-looking email or phone number can still be fake or mistyped. Validation catches typos and wrong formats, nothing more.
- Responders can get stuck. Google tells responders that if a validation rule is wrong or blocks the information they need, they should contact the form owner (Google Docs Editors Help). Test every rule in preview so that doesnât happen to your audience.
- One rule per question. The menu lets you pick one rule type for each question. If you need several conditions at once, a single regular expression is usually the way to combine them.
If your form needs more than this, such as checks that depend on earlier answers or file rules, compare the options in our list of Google Form alternatives, or see how Google Forms file uploads handle their own limits.
FAQ
Where is response validation in Google Forms?
Click the question, then the three-dot More menu at the bottom right of the question card, then Response validation. If you donât see it, check the question type: it appears for short answer, paragraph, and checkboxes questions.
Can Google Forms validate an email address?
Yes. Use a short answer question with the Text rule set to Email. It checks that the answer looks like an email address, not that the mailbox exists. Google Forms can also collect the respondentâs email for you through the formâs settings, which avoids typing errors altogether.
How do I limit the number of checkboxes someone can select?
Use response validation on a checkboxes question and choose Select at most (or Select exactly), then enter the number.
Can I use regex in Google Forms?
Yes. Choose Regular expression in the response validation menu on a short answer or paragraph question, then pick Contains, Doesnât contain, Matches, or Doesnât match and enter the pattern.