The Current State of HTML5 Forms

The pattern Attribute

<input type=text name=pattern-test  
  pattern="[0-9][A-Z]{3}">

Live Demo



Firefox
4+
Safari
5-
Safari Mobile
5-
Chrome
6
Chrome
10+
Opera
10.6
Opera
11+
IE
10+
Android
2.3-
Supported No support No support Kinda supported Supported Kinda supported Supported Supported No support

Supported Browser Screenshots

Chrome 10
Opera 11

The Low Down

Using the pattern attribute, you can declare your own requirements for validation using Regular Expressions (RegEx).

  • Opera's support can be buggy (v10.6).
  • Implies validation. The required attribute only needed if input can't be blank.
  • Like all validated fields, must have a name attribute.
  • Resource of useful patterns
  • Use the title attribute to describe what pattern you expect, as per the spec.