Nice tutorial! I just wish I could've found it before I wrote 500 lines of a class to do it

Then again, my class deals with comments and block comments, too

Two things though:
When it highlights the text, it's going to flash, isn't it?
Why not block that out with LockWindowUpdate() ?
csharp
[DllImport("user32.dll")] // import lockwindow to remove flashing
public static extern bool LockWindowUpdate (IntPtr hWndLock);
Then, in your TextChanged event, you could do the following:
csharp
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
try {
LockWindowUpdate(richTextBox1.Handle);
//Highlight every found word from keyWords.
//Get the last cursor position in the richTextBox1.
int selPos = richTextBox1.SelectionStart;
//For each match from the regex, highlight the word.
foreach (Match keyWordMatch in keyWords.Matches(richTextBox1.Text))
{
richTextBox1.Select(keyWordMatch.Index, keyWordMatch.Length);
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.SelectionStart = selPos;
richTextBox1.SelectionColor = Color.Black;
}
} finally {LockWindowUpdate(IntPtr.Zero);}
}
Also, with longer code, it could start to take a while. That could be fixed by working word for word. (Just read back to find the most recent space)
