What is the pattern attribute HTML?
Overview
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.
Syntax
<input pattern = "regular_expression">
Parameters
This attribute takes regular_expression as its single argument.
Example
Explanation
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.