I used an idea of a guy outsider ee to higlight keywords. It follows the code:
public Regex keyWords = (new Regex"abstract|as|base|bool....|....|....");
int selPos = richTextBox1.SelectionStart;
foreach (Match keyWordMatch in keyWords.Matches(richTextBox1.Text))
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.SelectionStart = selPos;
richTextBox1.SelectionColor = Color.Black;
the keywords are not correctly highlighted. I think that is because Index is not counting /r/n. I don't want to replace them because richtextbox will be unformatted?
Any easy solution ?