I am making a program to search for a user defined string in multiple *.RTF files (about 1200 files). All of the files are saved in a directory on my computer. So far I can search through one file fairly easily using the code below, but when I tried running it on all the files, it took about 3 minutes to complete the search. Can any one help me with a better search algorithm?
lookup = this.textBox1.Text.ToString();
MatchCollection matches = Regex.Matches(richTextBox1.Text, lookup);
foreach (Match match in matches)
{
richTextBox1.Select(match.Index, match.Length);
richTextBox1.SelectionColor = System.Drawing.Color.Red;
}