RESTRICT INPUT VALUES USING PATTERN MATCHING
You can use the pattern matching attribute, new in HTML5, to restrict input fields to values that follow a custom formatting pattern you define. This is useful if you need to ensure that the user submits correctly formatted values; otherwise display a message to the user and stops the form submission process.
<input type='text' ... pattern='pattern' title='title'>
The type attribute can be a text-based input type, such as text, number, telephone, and search. The pattern variable represents a regular expression syntax that defines the format of acceptable values that can be submitted by the user. A regular expression allows you to restrict values to very specific, finely tuned formats. Because different ...