Skip to content
Related Articles

Related Articles

HTML | <input> pattern Attribute

View Discussion
Improve Article
Save Article
  • Last Updated : 12 Aug, 2022

The HTML <input> pattern attribute is used to specify the regular expression on which the input elements value is checked against. 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">

Example: This example illustrates the use of pattern attribute in <input> element. 


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



Supported Browsers: The browser supported by HTML <input> pattern attribute are listed below:

  • Google Chrome 4.0
  • Edge 12.0
  • Internet Explorer 10.0
  • Firefox 4.0
  • Safari 5.0
  • Opera 12.1
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!