I am trying to scrub a list of items using another list and it's working fine except for its not ignoring case. When I try to add ordinal or regex casing checks, I get a syntax error. Can someone tell me what I am doing wrong? Here is my code:
List<string> removeChars = new List<string>(textBox_ScrubList.Text.Split(','));
for (int i = 0; i < sortBox1.Count; i++)
foreach (string repl in removeChars)
sortBox1[i] = sortBox1[i].Replace(repl, "", RegexOptions.IgnoreCase);
And here is the syntax error I am getting:
So I figured it out. The last line:
sortBox1[i] = sortBox1[i].Replace(repl, "", RegexOptions.IgnoreCase);
had to be changed to:
sortBox1[i] = Regex.Replace(sortBox1[i], repl, "", RegexOptions.IgnoreCase);