Merci pour les réponses j'arrive à ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Dim webRequest As WebRequest
Dim webResponse As WebResponse
webRequest = HttpWebRequest.Create("http://www.google.com/webhp?hl=fr")
webResponse = webRequest.GetResponse()
Using stream As StreamReader = New StreamReader(webResponse.GetResponseStream)
Dim r As New Regex("(?<word>\d)", RegexOptions.Multiline Or RegexOptions.IgnoreCase)
Dim input As String
Do While stream.Peek >= 0
input = stream.ReadLine
Dim matches As MatchCollection = r.Matches(input)
If matches.Count > 0 Then
' Console.WriteLine("{0} ({1} matches):", input, matches.Count)<br/>
For Each match As Match In matches
TextBox1.Text += match.Value
Dim strCodesource = TextBox1.Text
Dim intNb1 = InStr(1, strCodesource, "10") 'Position du caractère ">" dans le code source
Dim intNb2 = InStr(intNb1, strCodesource, "15") 'Position du caractère "<" dans le code source à partir de la position précédente (intNb1)
Dim strRecup = Mid(strCodeSource, intNb1, intNb2 - intNb1) 'Récupère le string qu'il y a entre les deux positions (intNb1 et intNb2)
Next
End If
Loop
End Using |
Problème j'ai l'erreur suivante
L'argument 'Start' doit être supérieur à zéro.
sur la ligne
Dim intNb2 = InStr(intNb1, strCodesource, "15")
Partager