Seach & Replace Through .HTM Files
Oi,
I have to write an app which will search through various "HTM" files and look for certain text and then replace it accordingly.
I have been researching for some time I am unsure how to start this, I have a few "Search & Replace" programs but I need to make my own.
If anyone can shed some light on this matter or point me in the correct direction I would appreciate you help.
Thanks...
Re: Seach & Replace Through .HTM Files
Well if you read the text into a string you can then use the string's Replace method, passing the search phrase and replacement phrase, to replace the text.
Re: Seach & Replace Through .HTM Files
Yeah, you'd have to do it the way penagate describes. After you do a replace, you would overwrite the original file and write out the new big string all at once, flush the writerstream, and finally close it.
Re: Seach & Replace Through .HTM Files
One word... Regex... now its a matter of finding out what types of strings you need to find...