1. Define a regular expression for validating each ofthe following:
a. A U.S. zip code, which must have five digits,followed by an optional hyphen and four digits.
b. A telephone number in the format (aaa) nnn-nnnn,where aaa represents the area code and the ns represent digits.
c. A date in the form of day-month-year, where themonth is a three-letter code and the year is four digits. A hyphenmust separate the day and month and year and month.
2. For the following codes, define the validationcriteria (there may be multiple checks for each field) and theorder in which you would test each of the conditions.
a. A credit card number entered on a Web form: Thecustomer has selected the type of credit card from a drop-downlist.
b. A part number in a hardware store: The part numberis a complex code, where the first digit represents the department(such as housewares, automotive, and so on), and the number shouldbe self-checking. There are seven different departments.
c. The date that a book was postmarked when returnedto an online bookstore: A copy of the customer receipt must beincluded with the book. Returned books must be postmarked within 30days of the purchase date.
d. A language spoken code used on a website: Hint:Search the Web for standard language codes.
e. The Canadian postal code: The format is X9X 9X9 (Xis any letter, 9 is any number).
f. Airport codes: Such as LAX for Los Angeles or DUBfor Dublin.