I have been creating google forms and the user is leaving the name field either blank or enter the number, I want to validate a name field in google forms in such a way that the user must not leave it blank or enter any numeric value in the name field.
Asked
Active
Viewed 4,783 times
1 Answers
2
There is an option Response Validation
in google forms you can use for each field. Just click the triple dot on the lower right of the field.
Then choose Regular expression
and Matches
on the following drop downs.
Use the regular expression below to accept valid names generally, and input an error message if the regular expression is not followed.
As for the blank response, make sure to toggle Required
button to require an input from the user on that specific field.
General regular expression you can use:
^[a-zA-Z ,.'-]+$
Above expression will only allow:
- upper and lower case letters
- spaces, commas, periods, apostrophes, and dashes
Expression can still be improved, check this for reference
Sample field should look like:
No input:
Number input or any other invalid character:
Valid input:
Note:
- Not matching the regular expression will prevent the user from submitting the response.
- Aside from valid names, the regular expression above won't prevent inputs like these:
...., ,,, ... ,,,,
q wn eu saj w okw u ks
john newman
Reference:

NightEye
- 10,634
- 2
- 5
- 24
-
Thank you NaziA for your response, I have used the same regular expression shared by you but still, it's accepting the space, I don't want it to accept space or 1-3 characters in the name, it must contain a minimum of 4 characters or maximum 20 character – user15110035 Aug 15 '21 at 10:02
-
hi @user15110035, if you want it to have those conditions, then you need to use this expression instead: `^[a-zA-Z,.'-]{4,20}$`. If you only want letters, then remove the other characters. `^[a-zA-Z]{4,20}$`. The latter expression means that you need to have 4-20 letters for your name to be valid. – NightEye Aug 16 '21 at 15:09
-
hi @user15110035, If this answered your question, please click the accept button on the left (check icon). By doing so, other people in the community, who may have the same concern as you, will know that theirs can be resolved. If the accept button is unavailable to you, feel free to tell me. [how to accept answer](https://stackoverflow.com/help/accepted-answer) – NightEye Aug 16 '21 at 15:11
-
hi @user15110035, see [this](https://meta.stackexchange.com/a/5235/1052490) on how to accept the answer. You need to click the little check icon on the left side of the answer. – NightEye Aug 18 '21 at 15:00