How do I find and extract strings from large strings/files (+100kB) f-a-s-t ? I've tried the RichTextBox.Find() and InStr() methods. They work fine when you search in smaller text, but when the string is big...

Example...

Sub TooSlow()

Dim i As Long
Dim j As Long

i = RichTextBox1.Find("<a href", , , rtfNoHighlight)
While i > -1
j = RichTextBox1.Find("</a>", i + 7, , rtfNoHighlight)
If j > -1 Then
' do stuff (a = mid(RichTextBox1,i,j) for example
Else
Exit Sub
End If
i = RichTextBox1.Find("<a href", j + 4, , rtfNoHighlight)
Wend
End Sub


Repeating the sub routine ten times is three times faster than calling it once with a ten times larger string...