This weekend I spent some time looking at adding support for regular expressions as part of the Google Forms validation functionality. This seemed like a reasonable and useful request. I was surprised to find that the jQuery Validation plugin doesn’t offer regular expressions as a standard check however, I found a fairly simple solution on Stack Exchange.
It took me a little while to get it working as Saturday morning I went down a wrong path initially following another post I had found. When I first read the post I linked to above, I convinced myself that I didn’t want to use the AddMethod solution. I am not sure why, I guess it was because I haven’t been into the code in a while so I was trying to avoid it. It turns out it is definitely the right answer and fairly easy to implement.
The beta build also contains a Serbo Croation translation provided by Borisa Djuraskovic
To see the new functionality in action, check out my Validation Demo Form where the last entry field must begin with a capital letter. The regular expression “[A-Z]” is used to match a capital letter when setting up the validation.Google Forms Beta (1634 downloads)