February 2014
Beginner
1248 pages
62h 25m
English
The h:validateRegex element at lines 41–42 uses the regular expression
((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}
which indicates that a phone number can contain a three-digit area code either in parentheses and followed by an optional space or without parentheses and followed by a required hyphen. After an optional area code, a phone number must contain three digits, a hyphen and another four digits. For example, (555) 123-4567, 555-123-4567 and 123-4567 are all valid phone numbers. If the phone number the user enters has an invalid format, the validatorMessage (line 40) will be displayed in the corresponding h:message element (line 44).
Read now
Unlock full access