Here's a good example that I put together as well.
Dim h_words As String() = {"one", "two", "three"} For Each word As String In h_words For Each m As Match In Regex.Matches(RichTextBox1.Text, word, RegexOptions.IgnoreCase).OfType(Of Match)() RichTextBox1.Select(m.Index, m.Length) RichTextBox1.SelectionColor = Color.Red Next Next
Possibly a bit faster as well for a few reasons, try it out and see :)
Provide the case statements or logic however you want based on the value of word as you see fit. (Around the line where you set the SelectionColor property.
Cheers
~Ace
If a post helps you in any way or solves your particular issue, please remember to use thePropose As Answer option or Vote As Helpful
Visit the Forum: TechLifeForum