YPLEX
[yplex]/[tcc]/[csc 2873 - advanced c++]/assignment 2
Assignment 2

The purpose of this assignment is to write a command-line utility that takes arguments of a regular expression, substitution text, and a list of files and for each of those files, substitutes all occurances of the regular expression with the substitution text. For each file, by default, the program will output the transformed text to a temporary file and replace the original file with the temporary file upon successful transformation. An optional argument may be given to cause the transformation to create a transformed copy of the file with the same name in another directory.

1. Write an application class that processes the following arguments:

-e expression
-t substitution text
[ -o output directory ]
files ...

expression is a regular expression capable of being recognized by boost::regex

substitution text is the text that will replace any text matching the regular expression.

output directory is an optional directory to which the result of the substitution will be performed. If this argument is not given, each file given on the command line will be replaced with the resulting substitution.

files ... is a list of files on which the substitution performed.

2. Inside the application class, implement an algorithm that will perform the actions indicated by the command-line arguments specified in (1).

3. Consider enhancements that would allow multiple search/replace targets from the command-line.