Hey VB-Paradise Com,
ich habe derzeit Probleme mit einem "einfachen" Regex - Programm.
Zum Programm: Ich verwende eine Textbox, Listbox und einen Button. Der Eingangstext wird in die Textbox eingetragen -> Ausgabetext ist in der Listbox.
Beispiel: Der Inputtext ist: <test id="10" a="0" b="0" c="1" d="0" e="0" f="2"/> Der Ausgabetext soll sein (Listbox): TEST PROG `t_protocol` VALUES ('10', '0', '0', '1', '0', '0', '2');
Mein Derzeitiger Programmcode sieht so aus:
Ich hoffe ihr könnt mir weiterhelfen.
PS: Habe noch keine guten Regex kenntnisse.
Mfg Regular_vb_user
ich habe derzeit Probleme mit einem "einfachen" Regex - Programm.
Zum Programm: Ich verwende eine Textbox, Listbox und einen Button. Der Eingangstext wird in die Textbox eingetragen -> Ausgabetext ist in der Listbox.
Beispiel: Der Inputtext ist: <test id="10" a="0" b="0" c="1" d="0" e="0" f="2"/> Der Ausgabetext soll sein (Listbox): TEST PROG `t_protocol` VALUES ('10', '0', '0', '1', '0', '0', '2');
Mein Derzeitiger Programmcode sieht so aus:
Quellcode
- Imports System.Text.RegularExpressions
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim Gefunden As New List(Of String)
- Dim Curr As String
- Dim MC As MatchCollection = Regex.Matches(TextBox1.Text, "<test id="(.*)" a="(.*)" b="(.*)" c="(.*)" d="(.*)" e="(.*)" f="(.*)"/>", RegexOptions.IgnoreCase)
- For i As Integer = 0 To MC.Count - 1
- If Gefunden.Contains(MC(i).Value) = False Then
- Curr = MC(i).Value.ToString
- ListBox1.Items.Add(Curr)
- End If
- Next
- End Sub
- End Class
Ich hoffe ihr könnt mir weiterhelfen.
PS: Habe noch keine guten Regex kenntnisse.
Mfg Regular_vb_user
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „Regular_vb_user“ ()