i have a function that give me the text between two words:
Private Shared Function GetBetween(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, Optional ByRef startPos As Integer = 0) As String
Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
Dim strResult As String
strResult = String.Empty
iPos = strSource.IndexOf(strStart, startPos)
iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
If iPos <> -1 AndAlso iEnd <> -1 Then
strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
End If
Return strResult
End Function
So my html code is:
<div class="upper-right-section">
<div class="header-stats">
<div class="stat-entry">
<span class="stat-value">48998</span>
<span class="stat-name">iscritti</span>
</div>
<div class="stat-entry">
<span class="stat-value">22760801</span>
<span class="stat-name">visualizzazioni video</span>
</div>
</div>
<span class="valign-shim"></span>
</div>
I got two times <span class="stat-value"> and i want to get the value of second match, how can i do? thanks, matteo.
For general html parsing, HAP or CSQuery are great, however if this is an isolated case in your program, and you are confident the html source will remain the same, you can use the following: