HTML pattern property
Example
An input field that can only contain three letters (no numbers or special characters):
Try it »
Browser support





Internet Explorer 10, Firefox, Opera, and Chrome support the pattern attribute.
**Note:** Safari or Internet Explorer 9 and earlier versions do not support the the pattern attribute of the tag.
Definition and Usage
The pattern attribute specifies the regular expression used to validate the element's value.
**Note:** The pattern attribute applies to the following input types: text, search, url, tel, email, and password.
**Tip:** Please use the global title attribute to describe the pattern to help users.
**Tip:** You can learn more about Regular expressions knowledge.
Differences between HTML 4.01 and HTML5
The pattern attribute is new in HTML5.
Syntax
Attribute values
| Value | Description |
|---|---|
| regexp | Specifies the regular expression used to validate the element's value. |
HTML tag