You can try regular expression
This expression will only work for lower case letters.
textBox1.Text = @"int\w*";
This is an assumed function in your Form
private void buttonHighLight_Click(object sender, EventArgs e)
{
HighLightWords(textBox1.Text);
HighLightWords(String.Format(@"{0}\w*", textBox1.Text);
}
This will highlight any word that matches the input expression.
private void HighLightWords(string wordExpression)
{
Regex regex = new Regex(wordExpression, RegexOptions.CultureInvariant | RegexOptions.Singleline);
foreach (Match m in regex.Matches(richTextBox1.Text))
{
richTextBox1.SelectionStart = m.Index;
richTextBox1.SelectionLength = m.Length;
richTextBox1.SelectionBackColor = Color.Yellow;
}
}