Why not build the application flexible so that you can change the client configuration instead of essentially reprogramming it? This sounds like more of a fundamental design problem. Perhaps you need to rethink how the application is built.
Can you explain a bit more about the variation from client to client? Are you creating multiple instances of the same application for different clients? Is this one application that have client context switching? It's is not obvious what solution to provide without some additional information.
Regarding the performance of the search: I think you are stuck with what you have. Simply put, a search searches everything within the file, character by character. No matter how you slice and dice the file contents, you still have to go thru all the lines and all the chars to find anything. But based on my previous comment, there may very well be a much more programmatically elegant, efficient and configurable way to build the application that may likely eliminate all this searching and replacing.
-
Peter