Input Email pattern property
Example
Get the value of the pattern property of the email field:
var
x = document.getElementById(
"myEmail"
).pattern;
x The output result is:
[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$
Try it »
Definition and Usage
The pattern property is used to set or return the value of the pattern attribute of the email field.
The pattern property describes a regular expression used to validate the value of the email field.
**Tip:** Use the global HTML title attribute or DOM title property to help the user describe the pattern.
Tip: You can learn more in our JavaScript tutorial about Regular expressions .
Tip: You can also check our JavaScript Regular Expression Reference Manual.
Browser support

Internet Explorer 10, Firefox, Opera, and Chrome browsers support the pattern property.
Note: Internet Explorer 9 and earlier IE versions, as well as the Safari browser, do not support the pattern property.
Note: Internet Explorer 9 and earlier IE versions, as well as the Safari browser, do not support .
Syntax
Return the pattern property:
emailObject
.pattern
Set the pattern property:
emailObject
.pattern=
regexp
Attribute values
| Value | Description |
|---|---|
| regexp | Describes the regular expression used to validate the email field |
Technical Details
| Return value: | String, representing a regular expression |
|---|
Related pages
HTML Reference Manual: HTML pattern property
Input Email Object