How to set a regular expression for an input element value that checked against using HTML ? Last Updated : 25 Dec, 2020 Comments Improve Suggest changes Like Article Like Report In this article, we will use <input> pattern attribute to set the regular expression pattern for an input field that checked against. 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. Syntax: <input pattern = "regular_exp"> Attribute Value: The pattern attribute is used to set the pattern of regular expression that enters into the input field. Example: This example illustrates the use of pattern attribute in <input> element. HTML <!DOCTYPE html> <html> <head> <title> How to specify a regular expression that an input element's value is checked against? </title> </head> <body style="text-align: center;"> <h1 style="color: green;"> GeeksforGeeks </h1> <h3> How to specify a regular expression that an input <br>element's value is checked against? </h3> <form action="#"> Name: <input type="text" name="Password" pattern="[A-Za-z]{10}" title="Three letter Password"> <input type="submit"> </form> </body> </html> Output: Supported Browsers: The browser supported by HTML <input> pattern attribute are listed below: Google Chrome 5.0Internet Explorer 10.0Firefox 4.0Safari 10.1Opera 9.6 Comment More infoAdvertise with us Next Article How to set a regular expression for an input element value that checked against using HTML ? V vkash8574 Follow Improve Article Tags : Web Technologies HTML HTML-Questions Similar Reads How to specify a short hint that describes the expected value of an input element using HTML ? The placeholder attribute specifies a short hint for input field that describes the expected value of an input field/text area. The short hint is displayed in the field before the user enters a value. Syntax: <element placeholder="value"> Attribute Value: This attribute describes the short hin 1 min read How to define a label for an input element using HTML? To define a label for an input element in HTML5, use the <label> tag. This tag enhances usability by allowing users to click on the label text to toggle the associated input control. The <label> tag should include a for attribute that matches the id of the input element, ensuring a clear 1 min read How to specify the value of an input element using HTML ? In this article, we will set the value of an input element using HTML. The value attribute for <input> element in HTML is used to specify the initial value of the input element. It has different meaning for different input type: The âbuttonâ, âresetâ and âsubmitâ property specifies the text on 1 min read How to validate HTML tag using Regular Expression Given string str, the task is to check whether it is a valid HTML tag or not by using Regular Expression.The valid HTML tag must satisfy the following conditions: It should start with an opening tag (<).It should be followed by a double quotes string or single quotes string.It should not allow on 6 min read How to Set a Minimum and Maximum Value for an input element in HTML5? To set minimum and maximum values for an input element in HTML5, we utilize the min and max attributes. For numerical inputs like type numbers, assign the desired limits directly. Alternatively, use JavaScript validation, pattern attributes, or event listeners for more complex validation scenarios, 3 min read Like