diffsnack
HTMLAttribute

What is pattern in HTML?

A regular expression that the whole value of a text <input> must match; if the field is not empty and does not match, the browser blocks the form when it is submitted.

Example

<input type="text" name="zip" pattern="[0-9]{4}">

Practice HTML in a 2-minute game →