I'm writing the contents of a text file to a StringBuilder and I then want to perform a number of find/replace actions on the text contained in the StringBuilder using regular expressions.
I've run into a problem as the StringBuilder replace function is not capable of accepting regular expression arguments.
I could use Regex.Replace on a normal string but I'm under the impression that this is inefficient due to the fact that two copies of the string will need to be created in memory as .net strings are immutable.
Once I've updated the text I plan to write it back to the original file.
What's the best and most efficient way to solve my problem?
EDIT
In addition to the answer(s) below, I've found the following questions that also shed some light on my problem -