Benutzerinformationen überspringen
Dabei seit: 1. Februar 2009
Wohnort: Hohenstein Holzhausen
Frühere Benutzernamen: pihreut
|
|
Visual Basic Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Dim Lines() As String = Hintergrund.txt_links.Text.Split(vbNewLine) Try If My.Computer.FileSystem.FileExists(Application.StartupPath & "\temp.txt") Then My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\temp.txt") End If My.Computer.Network.DownloadFile(Lines(0), Application.StartupPath & "\temp.txt") Dim rx As New Regex("<img(.*)src=""(?<url>([a-zA-Z0-9.:-_/]+))""(.*)>", RegexOptions.Compiled Or RegexOptions.IgnoreCase) Dim rxMatches As MatchCollection = rx.Matches(My.Computer.FileSystem.ReadAllText(Application.StartupPath & "\temp.txt")) For Each oMatch As Match In rxMatches MsgBox(oMatch.Groups(Lines(0)).ToString()) Hintergrund.txt_dateien.Text = Hintergrund.txt_dateien.Text & oMatch.Groups(Lines(0)).ToString() & vbNewLine Next Catch ex As Exception MsgBox("Fehler beim auslesen der Links von der Seite " & Lines(0) & ":" & vbNewLine & vbNewLine & ex.Message) End Try |
|
|
Quellcode |
1 |
<td headers="thAnzahl" align="right">100.000</td> |
|
|
Visual Basic Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim adress As String Dim w As New WebClient adress = TextBox45.Text Dim quelltext As String = w.DownloadString(adress) Dim WertRegex1 As New System.Text.RegularExpressions.Regex("<td headers=\""thAnzahl\"" align=\""right\"">(?<Wert2>([0-9.]*))</td>") Dim Wert2 As String = WertRegex1.Match(quelltext).Groups("Wert2").ToString() TextBox44.Text = Wert2 End Sub |
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
<tr> <td headers="thEinheit">Wassermine</td> <td headers="thAnzahl" align="right">100.000</td> </tr> <tr> <td headers="thEinheit">Landmine</td> <td headers="thAnzahl" align="right">20.000</td> </tr> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Dim RegEx_Treffer As New Regex("<td headers=""thEinheit"">(?<Treffer>(.*?))</td>")
Dim Treffergruppe As MatchCollection
Dim Treffer As Match
Dim ListBox As New ListBox
Dim Zahl As Integer
Try
Treffergruppe = RegEx_Treffer.Matches(RichTextBox1.Text)
For Each Treffer In Treffergruppe
ListBox.Items.Add(Treffer.Groups("Treffer").Value)
Next
For Zahl = 0 To ListBox.Items.Count
TextBox1.Text &= ListBox.Items(Zahl) & vbCrLf
Next
Catch ex As Exception
End Try
|
|
|
Quellcode |
1 |
"<td headers=""thEinheit"">(?<Treffer>([^>]*))</td>" |
|
|
Visual Basic Quellcode |
1 |
[^<]* = hier darf alles kommen außer < |
|
|
Visual Basic Quellcode |
1 |
Dim RegEx_Treffer As New Regex("<td headers=""thEinheit"">(?<Treffer>(.*?))<") |
|
|
Visual Basic Quellcode |
1 |
Dim RegEx_Treffer As New Regex("thEinheit"">(?<Treffer>(.*))<") |
|
|
Visual Basic Quellcode |
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 27 28 29 30 31 32 33 34 35 36 37 38 |
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim adress As String = "http://xxxx.html" Dim w As New WebClient 'adress = TextBox45.Text Dim quelltext As String = w.DownloadString(adress) RichTextBox1.Text = quelltext Dim RegEx_Treffer As New Regex("<td headers=\""thEinheit\"">(?<Treffer>(.*?))</td>") Dim Treffergruppe As MatchCollection Dim Treffer As Match Dim ListBox As New ListBox Dim i As Integer Try Treffergruppe = RegEx_Treffer.Matches(RichTextBox1.Text) For Each Treffer In Treffergruppe 'Umlaute ersetzen Dim builder As New StringBuilder(Treffer.Groups("Treffer").Value) With builder .Replace("ß", "ß") .Replace("ä", "ä") .Replace("Ä", "Ä") .Replace("ö", "ö") .Replace("Ö", "Ö") .Replace("ü", "ü") .Replace("Ü", "Ü") End With ListBox.Items.Add(builder.ToString()) Next For i = 0 To ListBox.Items.Count TextBox1.Text = ListBox.Items(0) TextBox2.Text = ListBox.Items(1) TextBox3.Text = ListBox.Items(2) TextBox4.Text = ListBox.Items(3) TextBox5.Text = ListBox.Items(4) 'weitere Textboxen Next Catch ex As Exception End Try |
Benutzerinformationen überspringen
Dabei seit: 26. Dezember 2009
Frühere Benutzernamen: Gutelaunetyp


Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Gutelaunetyp« (4. Juli 2010, 14:39)
|
|
Visual Basic Quellcode |
1 2 3 4 5 6 7 8 9 |
Dim httpRequest As Net.HttpWebRequest = Net.HttpWebRequest.Create("http://croomeware.cr.funpic.de/test.html") Dim httpResponse As HttpWebResponse = httpRequest.GetResponse() Dim reader As StreamReader = New StreamReader(httpResponse.GetResponseStream) Dim httpContent As String = reader.ReadToEnd Dim ipRegEx As New Regex("\<div id=\""helloworld\""\>(?<string>(.*))\<\/div\>") Dim HelloWorld As String = ipRegEx.Match(httpContent).Groups("string").ToString() Label1.Text = HelloWorld |
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »xWare Development« (13. Juli 2010, 11:07)
|
|
Quellcode |
1 |
"\<div id=\""helloworld\""\>(?<string>([^<^]*))\<\/div\>" |
|
|
Visual Basic Quellcode |
1 |
[^<^] |
|
|
Visual Basic Quellcode |
1 |
Dim ipRegEx As New Regex("\<a href=\""(?<string>([a-z.]*))""\>") |