HTML and CSS Reference
In-Depth Information
Figure 17.39 The user enters a five-digit zip code (top); the user enters nothing
(middle); the user enters four digits and one letter (bottom).
17.5.3 Checking for Alphabetic Data
To test for entries that must consist strictly of alphabetic input, such as a name, state, or
country field, the regular expression character set can be used; for example, /[a-zA-z]+/
is a regular expression that matches a string containing one or more uppercase or low-
ercase letters, and /^[a-zA-Z]+$/ matches a string containing only one or more upper-
case or lowercase letters, because the character set is enclosed within the beginning
and ending anchor metacharacters. To represent one or more alphanumeric word
characters, [A-Za-z0-9_], you can use the \w metasymbol; for example, /\w+/ represents
one or more alphanumeric word characters.
 
 
Search WWH ::




Custom Search