Hey guys! This is my first post on the forum so please excuse me if I do something wrong. I've posted this on many forums, however, no one has seemed to give me an answer. So hopefully you guys can help.
Here is my existing Syntax Highlighting code :
Code:
    Dim listbox1 As New ListBox
    listbox1.Items.Add("<br/>")
    Dim int As Integer = 0
    Dim line As String = RichTextBox1.GetLineFromCharIndex(RichTextBox1.SelectionStart)
    For Each item In listbox1.Items
      If RichTextBox1.Lines(line).Contains(item) Then
        Dim instance As Integer = RichTextBox1.Find(item, RichTextBox1.SelectionStart - CInt(item.ToString.Length), RichTextBox1.SelectionStart)
        If instance > 0 Then
          RichTextBox1.SelectionStart = RichTextBox1.SelectionStart - CInt(item.ToString.Length)
          RichTextBox1.SelectionLength = item.ToString.Length
          RichTextBox1.SelectionColor = Color.Blue
        End If
      End If

    Next
    RichTextBox1.SelectionStart = ss
    RichTextBox1.SelectionLength = sl
    RichTextBox1.SelectionColor = Color.Black
The problem I'm having, is this code also colors around 4 characters after the instance. This confuses me. Any help would be appreciated!