11
Reply

C# regex file parser

Tommy Bell

Tommy Bell

Feb 27 2008 3:58 AM
8k
While I can do a few things in C# I have a need for making a text-parser, and I have been unable to figure out how to to this.

Essentially what it has to do is

- take threearguments and a text file,
- if the first and second argument are present in the file
- replace the first argument with the third argument given

-- Example begin

c:\> textparser.exe u Threshold News file.txt

If u and threshold are present, replace u with News

-- Example end


I am guessing this has to be done with regex, as the file has to be searched through but I am not sure.

Any help is greatly appreciated.

Regards

Answers (11)