Skip to content
Related Articles

Related Articles

Improve Article

HTML | pattern Attribute

  • Difficulty Level : Basic
  • Last Updated : 22 Jul, 2019

This attribute is used to specify the regular expression on which the input element value is checked. This attribute works with the following input types: text, password, date, search, email, etc. Use the Global title attribute to describe the pattern for helping the user.


<input pattern = "regular_exp">

Element: This attribute is associated with <input> element only.

Attribute: This attribute specifies the regular expression.


<!DOCTYPE html>
        <title>pattern attribute</title>
            body {
            h1 {
        <h2>pattern attribute</h2>
        <form action="#">
            Password: <input type="text" name="Password"
            pattern="[A-Za-z]{3}" title="3 letter Password">
        <input type="submit">


Supported Browsers: The browser supported by pattern attribute are listed below:

  • Google Chrome 5.0 and above
  • Internet Explorer 10.0 and above
  • Firefox 4.0 and above
  • Opera 9.6 and above

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :