VOOZH about

URL: https://www.geeksforgeeks.org/html/html-input-pattern-attribute/

⇱ HTML <input> pattern Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <input> pattern Attribute

Last Updated : 26 May, 2026

The pattern attribute is used to define a regular expression that the input value must match. It helps validate user input before form submission.

  • Specifies a pattern or format for the input value.
  • Commonly used with text, password, email, and telephone input fields.
  • If the entered value does not match the pattern, the form cannot be submitted.

Syntax: 

<input pattern = "regular_exp">

Example: Illustrates the use of pattern attribute in <input> element. 

Comment
Article Tags: