EDDYMENS

Published 2 years ago

Google Forms: Validate A Provided Email Address

Google forms do not provide a way to validate common input types out of the box such as an email text field.

To ensure that a text field takes only emails, you will need to use the validation option.

We will look at setting rules for one of the most common input types: emails.

How to add custom validation

Google validation flow walkthrough [→]

Follow these steps to add validation rules to your text field:

  • Click on the vertical three dots next to the Required toggle button.
  • Click on Response Validation from the menu that appears to reveal the rules section.
  • From the rules section select Regular expression from the first dropdown menu.
  • From the dropdown next to that select the Matches option.

This can also be seen in the GIF above.

The Pattern field is where we will be adding our actual rules in regex.

Email address validation

Now that we have seen how to add validation rules, we will look at the regex we need for pattern matching.

In the pattern textbox add the following regex:

01: [a-zA-Z0-9_\.\+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+

Do note that this only checks the email structure and does not mean the provided email exists.

You can also set an error message in the Custom error textbox. For example "Please provide a valid email address".

This will be shown to the user whenever they provide an invalid email.

Here is another article you might like 😊 Heroku cron jobs made easy and free