Dim pattern As String = "\<(?<tagName>\w+)" Dim matches = System.Text.RegularExpressions.Regex.Matches(RichTextBox1.Text, pattern) For Each match As System.Text.RegularExpressions.Match In matches Dim start As Integer = match.Groups("tagName").Index Dim length As Integer = match.Groups("tagName").Length RichTextBox1.Select(start, length) RichTextBox1.SelectionColor = Color.Blue Next