What I’m Learning: How to limit the number of words in a response to a Google Form question.

What I’m Learning: How to limit the number of words in a response to a Google Form question.

While you can use the advanced data validation properties of a Google Form question to limit the number of characters in an answer, you will need a regular expression in order to limit the number of words. If you ever have such a need, here it is:

^\s*(\S+\s+){1,9}\S*$

This regular expression will limit the response to 10 words. You can change the 1 and the 9 if you want to have different limits on the number of words (the 1 represents the lowest number your question will accept and the 9 represents the highest).

This is what it looks like in a question:

One comment

  1. Katherine Bennett

    Excellent post and very useful, but – what if you want to limit an answer to 1500 words? The formula doesn’t allow upper-limit numbers above 999 it seems. What I’m trying to use is ^\s*(\S+\s+){1,1500}\S*$ and it won’t accept that. And since the two numbers are separated by a comma, it won’t accept “1,500” in there either.

Leave a Reply

%d bloggers like this: