Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The lines in a contact list text file have the format: Last name, first name phone number email address Write a Perl-style regular expression that

The lines in a contact list text file have the format: Last name, first name phone number email address Write a Perl-style regular expression that matches lines that begin with an L, and then include in left-to-right order: the string ", " (comma followed by a space) a phone number formatted with dashes as separators (for example, 415-123-4567). @csm.edu at the end of the line. Perl uses \d to match a decimal digit; .* to match zero or more characters of any type; and \. to match a . (dot in an email address). ^ matches a newline, or the start of a first line in a file, and $ matches the end of a line. The other characters you will need, such as @ and -, simply match themselves. You can test your regular expression with the command grep -p (for Perl) from the Unix command line, using the file regex_test.txt listed below. For example: grep -p "^ .*\.$" regex_test.txt If your regular expression is correct, the grep command will list only the line: Lee, Robin 623-456-7890 rlee@csm.edu

regex_test.txt listing: Lee,Robin 023-456-7890 rlee@csm.edu lee, Robin 123-456-7890 rlee@csm.edu Lee, Robin 223-456-7890 rlee@csm%edu Lee, Robin 323 456-7890 rlee@csm.edu Lee, Robin 423-456-7890 rlee@comcast.net Lee, Robin 523-456-7890 rlee@csm.edu. Lee, Robin 623-456-7890 rlee@csm.edu Young, Chris 723-456-7890 rlee@csm.edu Lee, Robin 823-456-7890 rlee@csm.edu* Lee 93-456-7890 rlee@csm.edu*

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

10 10. x+2-2 Use an analytical method to find Lim x 2 x-2

Answered: 1 week ago