Pattern Attribute Description:
The pattern attribute defines a regular expression for a pattern that form data should take when submitted in an HTML form.
This attribute is valid in HTML5.
The Pattern Attribute is Used with These Tags:
The Pattern Attribute Contains:
The pattern attribute contains a regular expression that the data must match to be submitted. The regular expression is based on JavaScript regular expressions.
Here is an example of an INPUT telephone field with a pattern looking for a phone number like this: “(###) ###-####.”
<input type="tel" id="phone" pattern="([0-9]{3}) [0-9]{3}-[0-9]{4}>
Pattern Default Value:
The pattern attribute default value is empty, so that no pattern is required to submit the data.
Pattern is Valid in HTML Versions:
- HTMl5
- XHTML5
Pattern Attribute DTD:
HTML5
<doctype html>

