سلام
یه راه بهتر
شما می تونید توی ایونت richtextbox از یه حلقه for استفاده کنید و هر کلمه ای را که می خواهید جستجو کند و اون را به رنگ دلخواهتان نشون بدهprivate void tb3_richtxb_TextChanged(object sender, EventArgs e)
{
for ( int i = 0; i < tb3_richtxb.Text.Length;i++ )
{
tb3_richtxb.Find("if", i, RichTextBoxFinds.WholeWord);
tb3_richtxb.SelectionColor = Color.Red;
tb3_richtxb.DeselectAll();
tb3_richtxb.Find("else", i, RichTextBoxFinds.WholeWord);
tb3_richtxb.SelectionColor = Color.Blue;
tb3_richtxb.DeselectAll();
tb3_richtxb.SelectionColor = Color.White;
}
}