HTML and CSS Reference
In-Depth Information
Figure 7-3 The validation tip displayed in Google Chrome when the input does not match the validation pattern.
Regular Expression Basics
Regular expressions can be a bit daunting at times; people have written whole books about them (they're truly terri-
fying—the books, not the people!). There are thousands of different patterns that you could create, but in this sec-
tion, I want to walk you through the basics and show you some of the most common patterns you might need to use
when building web forms.
Validating Characters
You can restrict the characters that can be used by specifying them in a pattern. To do
this, you first create a set of square brackets [] that you will place your valid characters inside. If you wanted to lim-
it the input to an alphanumeric string that does not allow spaces of special characters, for example, you could use the
following code.
Search WWH ::

Custom Search