Regular expressions and form validation
By far, one of the most common uses for regular expressions on the frontend is for use with user submitted forms, so this is what we will be building. The form we will be building will have all the common fields, such as name, e-mail, website, and so on, but we will also experiment with some text processing besides all the validations.
In real-world applications, you usually are not going to implement the parsing and validation code manually. You can create a regular expression and rely on some JavaScript libraries, such as:
- jQuery validation: Refer to http://jqueryvalidation.org/
- Parsely.js: Refer to http://parsleyjs.org/
Note
Even the most popular frameworks support the usage of regular expressions with its native validation engine, such as AngularJS (refer to http://www.ng-newsletter.com/posts/validations.html).
Setting up the form
This demo will be for a site that allows users to create an online bio, and as such, consists of different types of fields...