DOC PREVIEW
UT CS 341 - Homework 5

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Homework 5 Regular Expressions in UNIX 1 CS 341 Homework 5 Regular Expressions in UNIX Regular expressions are all over the place in UNIX, including the programs grep, sed, and vi. There's a regular expression pattern matcher built into the programming language perl. There's also one built into the majordomo maillist program, to be used as a way to filter email messages. So it's easy to see that people have found regular expressions extremely useful. Each of the programs that uses the basic idea offers its own definition of what a regular expression is. Some of them are more powerful than others. The definition in perl is shown on the reverse of this page. 1. Write perl regular expressions to do the following things. If you have easy access to a perl interpreter, you might even want to run them. (a) match occurrences of your phone number (b) match occurrences of any phone number (c) match occurrences of any phone number that occurs more than once in a string (d) match occurrences of any email address that occurs more than once in a string (e) match the Subject field of any mail message from yourself (f) match any email messages where the address of the sender occurs in the body of the message 2. Examine the constructs in the perl regular expression definition closely. Compare them to the much more limited definition we are using. Some of them can easily be described in terms of the primitive capabilities we have. In other words, they don't offer additional power, just additional convenience. Some of them, though, are genuinely more powerful, in the sense that they enable you to define languages that aren't regular (i.e., they cannot be recognized with Finite State Machines). Which of the perl constructs actually add power to the system? What is it about them that makes them more powerful?Homework 5 Regular Expressions in UNIX 2 Regular Expressions in perl from Programming in Perl, Larry Wall and Randall L. Scwartz, O’Reilly & Associates,


View Full Document

UT CS 341 - Homework 5

Documents in this Course
Load more
Download Homework 5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework 5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?