CARVIEW |
Select Language
HTTP/2 301
server: GitHub.com
content-type: text/html
location: https://webplatform.github.io/docs/html/attributes/pattern/
access-control-allow-origin: *
expires: Wed, 15 Oct 2025 11:23:01 GMT
cache-control: max-age=600
x-proxy-cache: MISS
x-github-request-id: F3B4:72792:081B:0951:68EF81BD
accept-ranges: bytes
age: 0
date: Wed, 15 Oct 2025 11:13:01 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210085-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760526782.696212,VS0,VE286
vary: Accept-Encoding
x-fastly-request-id: 02defc078c8c719bc03ab5f9c18e96e4995ecaaf
content-length: 162
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Thu, 09 Jan 2020 08:57:10 GMT
access-control-allow-origin: *
etag: W/"5e16eae6-1983"
expires: Wed, 15 Oct 2025 11:23:02 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 8851:7A3DE:0B61:0C97:68EF81BD
accept-ranges: bytes
age: 0
date: Wed, 15 Oct 2025 11:13:02 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210085-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760526782.996078,VS0,VE291
vary: Accept-Encoding
x-fastly-request-id: 797d5fd37beaaee6d09f6133d8059c9298c4c818
content-length: 2356
pattern · WebPlatform Docs
## Examples
This page is Not Ready
Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.
pattern
Summary
The pattern attribute specifies a regular expression that the <input> element’s value is checked against.
Applies to | [HTMLInputElement](/html/elements/input) |
---|
Numeric field: <input type="text" name="numericField" pattern="[0-9]*" />
Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
Notes
Remarks
Several generic messages are displayed for a variety of validation errors. If you use a title attribute on an input element, it will both be shown as alt text for the field, as well as be appended to the generic error message. The following example shows a ZIP code number format.
Syntax
Standards information
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10.7.3.9
See also
Related pages
- HTMLInputElementHTMLInputElement
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]