Copy current line textbox to textbox2 via regex detect RRS feed

  • Question

  • hi guys

    i have 2 textbox , i want via check regex match copy ip text in ( property | | Operating system | Windows ) from textbox 1 to textbox 2

    my text:

    Status | Name | Type | Operating system | IP | NetBIOS name | NetBIOS group | Manufacturer | MAC address | User
    property | | Operating system | Windows
    alive | WIN-3Q9P1I8JN6A |  |  | | WIN-3Q9P1I8JN6A | WORKGROUP |  | 00:00:00:00:00:00 | 
    property | | Operating system | Windows
    property | | Operating system | Windows
    property | | Operating system | Windows

    my code:

       Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            Dim reg_exp As New Regex("\b[| Operating system | Windows]\b")
            If reg_exp.IsMatch(TextBox1.Text) Then
    TextBox2.BackColor = Color.Green
                TextBox2.BackColor = Color.Yellow
            End If
        End Sub

    Friday, November 2, 2018 4:58 PM

All replies

  • Hi,

    I think you can use richTextBox control to copy the matching lines in RichTextBox1 to richTextBox2.

    Imports System.Text.RegularExpressions
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            For Each a In RichTextBox1.Lines
                Dim reg_exp As New Regex("\b104.223.22.67\b")
                If reg_exp.IsMatch(a) Then
                    RichTextBox2.Text += a
                End If
        End Sub
    End Class

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, November 5, 2018 2:23 AM