The “pattern” attribute specifies a regular expression that the <input> element’s value is checked against on form submission
Syntax
<input pattern=”regexp“>
| regexp | Specifies a regular expression that the <input> element’s value is checked against |
<input type="email" placeholder="Email" name="email" id="email" pattern="^[\w]{1,}[\w.+-]{0,}@[\w-]{2,}([.][a-zA-Z]{2,}|[.][\w-]{2,}[.][a-zA-Z]{2,})$" Required>
Pattern of valid emails are
1.An e-mail address always starts with a word.
. or ” cannot be in the starting of email id. Double quotes are not allowed in the mail id
2.Word before @ can contain +,-,.,_ and words and numbers.
3.Only one @ is allowed
4.Subdomains are allowed(Ex : email@example.co.in)
4.Domain (After @) cant have numbers in the end.
5.Domain can’t have – in the starting