Dim exp As String = "de[ea]l" ' will be edtSearch.Text
'Previous posting mentioned something about beginning fragments, so here is a fictional checkbox
If ckAtBeginning.Checked then
exp = $"^${exp}.*"$ ' Regular expression to find fragment at beginning
Else If ckAtEnd.Checked Then ' Just to show if one wants to find fragment at end
exp = $".*${exp}$"$ ' find it at the end
Else
exp = $".*${exp}.*"$ ' or anywhere
End If
'Note to the above. Not modifying exp would allow for searching for an exact match for a given regular expression. Looks like
'in this case that may not make sense, since each line is very long, but may in other cases (where the line content is short).
Dim MatchCount As Int = 0
For i = 0 To Data.Size - 1
Dim Line As String = Data.Get(i)
If Regex.IsMatch2(exp, Regex.CASE_INSENSITIVE, Line) Then
MatchCount = MatchCount + 1
ResultList.Add(Line)
If MatchCount >= 100 Then
Msgbox2Async("More than 100 matches found. Terminating search early.", "Search", "OK", "", "", Null, True)
Exit
End if
End If
Next