' GetBetween Function
Private Function GetBetween(ByVal haystack As String, ByVal needle As String, ByVal needle_two As String) As String
Dim istart As Integer = InStr(haystack, needle)
If istart > 0 Then
' Dim istop As Integer = InStr(istart, haystack, needle_two)
Dim istop As Integer = InStr(istart + Len(needle), haystack, needle_two)
If istop > 0 Then
Try
Dim value As String = haystack.Substring(istart + Len(needle) - 1, istop - istart - Len(needle))
Return value
Catch ex As Exception
Return ""
End Try
End If
End If
Return ""
End Function
' GetAllStringsBetween Function
Private Function GetAllStringsBetween(ByVal Haystack As String, ByVal StartSearch As String, ByVal EndSearch As String) As String()
Dim rx As New Regex(StartSearch & "(.+?)" & EndSearch)
Dim mc As MatchCollection = rx.Matches(Haystack)
Dim FoundStrings(mc.Count) As String
Dim i As Integer = 0
For Each m As Match In mc
FoundStrings(i) = m.Groups(1).Value.ToString()
i += 1
Next
Return FoundStrings
End Function