Practice Evaluation (Easy)

You have 10 minutes to complete this evaluation.

Use the regexquiz tool to write a regular expression that recognises valid U.S. phone numbers. U.S. phone numbers have the format:

The following are valid U.S. phone numbers:

808 555 5555

808-555-5555

213-555-6523

The following are not valid

89-636-48018

89/636-48018

Instructions for trying the easy problem

1. Open a command window and start the regexquiz. You can use either of the following commands to start the quiz:

$ regexquiz easy

RegExQuiz! ICS 215 RegEx quizzer.
Type #question to see the quiz question. Then type in the regular
expression that solves the question. When you hit return the quizzer
will show you lines that match that regex, or nothing if nothing matches.
Type #quit to quit.

Loaded Quiz easy

Write a regular expression that recognises valid U.S. phone numbers. U.S. phone numbers have the format:

 * Three digit area code followed by a dash or space,
 * Three digit exchange code followed by a dash or space,
 * Four digit subscriber number.

The following are valid U.S. phone numbers:

808 555 5555
808-555-5555
213-555-6523

The following are not valid U.S. phone numbers:

89-636-48018
89/636-48018
quiz >

or

$ regexquiz
    
RegExQuiz! ICS 215 RegEx quizzer.
Type #question to see the quiz question. Then type in the regular
expression that solves the question. When you hit return the quizzer
will show you lines that match that regex, or nothing if nothing matches.
Type #quit to quit.
    
No quiz loaded.
Load the quiz using '#load_quiz <quiz code>'
    
quiz >#load_quiz easy
Loaded Quiz easy
    
Write a regular expression that recognises valid U.S. phone numbers. U.S. phone numbers have the format:
    
 * Three digit area code followed by a dash or space,
 * Three digit exchange code followed by a dash or space,
 * Four digit subscriber number.
    
The following are valid U.S. phone numbers:
    
808 555 5555
808-555-5555
213-555-6523
    
The following are not valid U.S. phone numbers:
    
89-636-48018
89/636-48018
quiz >

2. Start entering your regular expression to match the valid phone numbers.

3. When you have your solution, quit regexquiz by typing “#quit” at the command prompt.

4. Find the text file with the name <username>easy.txt

This file is automatically created by regexquiz. It includes the commands that you typed in the quizzer. On my laptop the filename is carletonmooreeasy.txt.

5. Email the file to Cam and Jan

Send an email with the file attached to cmoore@hawaii.edu and dufek@hawaii.edu. The timestamp on the email will indicate when you completed the quiz. For an easy quiz you have 10 minutes to complete the problem.

Watch me solving the problem

After trying out the problem you can watch me solve the problem.