In this exercise, we look at three approaches to displaying the results of regular expression searches. As we've been doing, we'll write each result directly to cout and will then use regex_match::format to insert characters from each match into an output iterator that writes to cout; finally, we'll use regex_replace to manage the search loop for us.
Write a program that searches for text in the form "name: first-name last-name" and inserts the contents of each successful match into cout with the last name first, followed by a comma, followed by the first name.
Write a program that uses a pair of regex_iterator objects to do the search and calls iter->format to write all the desired text to cout. You can use an iterator object ostream_iterator<char> out(cout, "") to insert individual characters into cout.
Write a program that uses regex_replace with the flag format_no_copy to search for matches and write out their contents.