Using the pattern attribute, you can declare your own requirements for validation using Regular Expressions.
Relevant for the text, search, url, tel, email, and password types: the input types that allow for freeform data entry and don't have predefined patterns the values must match.
The value of the pattern attribute is a regular expression that must match the entire value of the input.
The empty string is considered valid (no misMatch) unless the required attribute is present as well (valueMissing).
For email input types, if you include both the pattern and multiple attributes, remember that the pattern must match the entire value!
Use the title attribute to describe what pattern you expect, as per the spec. When the pattern attribute is included, the item's title attribute gets special meaning. If there is a patternMismatch during constraint validation , the title value will be included as content in the error bubble displayed in supporting browsers - as displayed to the left ("Enter 3 characters" was the title). That's why the previous point -- describe the pattern you expect, not the purpose of the input -- is important to remember.
If the pattern attribute is present, the non-empty value must match the pattern attribute. If the value does not match the regular expression, the patternMismatch constraint validation error message and title will be displayed in the error bubble upon form submission.