In pattern attribute is used to specify the regular expression on which we check the pattern of input values. This attribute works with the <input> elements.
We use this attribute with the following input types: text, email, date, password, etc.
<input pattern = "regular_expression">
This attribute takes regular_expression as its single argument.
In the above example, we set the pattern of password type to accept a minimum of 6 characters. So, if we add fewer characters, it shows a warning message.