Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

I. Exercises > 7. In the World of Regular Expressions

Chapter 7. In the World of Regular Expressions

7.1. Write a program that matches a string containing either “fred” or “barney” then reports the part of the string before the match, the part of the string after the match, and the name that it matched. (Answer to Exercise 7.1)

7.2. Write a program to match a line that has an “a”, a “b”, and a “c”, in that order. Any number of characters can be between those letters. (Answer to Exercise 7.2)

7.3. Write a program to match a string that has an “a”, a “b”, and a “c”, in that order, but must have at least one other character between each of those letters. (Answer to Exercise 7.3)

7.4. Write a program to match a string that contains an “a”, but doesn’t have a “b” anywhere after the “a”. (Answer to Exercise 7.4)


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint