Question: 1. Define a regular expression for validating each of the following: a. A U.S. zip code, which must have five digits, followed by an optional

1. Define a regular expression for validating each of the 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 the month is a three-letter code and the year is four digits. A hyphen must separate the day and month and year and month.

2. For the following codes, define the validation criteria (there may be multiple checks for each field) and the order in which you would test each of the conditions.

a. A credit card number entered on a Web form: The customer has selected the type of credit card from a drop-down list.

b. A part number in a hardware store: The part number is a complex code, where the first digit represents the department (such as housewares, automotive, and so on), and the number should be self-checking. There are seven different departments.

c. The date that a book was postmarked when returned to an online bookstore: A copy of the customer receipt must be included with the book. Returned books must be postmarked within 30 days 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 (X is any letter, 9 is any number).

f. Airport codes: Such as LAX for Los Angeles or DUB for Dublin.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!