Hello Folks,

Im really newbie in VB.NET and i hope that someone could explain how may i do this successful,

ok im explaining now..

I had two richtextboxes and one button

First richtextbox contains the following text:

<user_register.php: 2012-02-21 00:03:49

POST
username=sexhunger15
email=ho_t@hotmail.com
email_confirm=
password=vergota
password_confirm=vergota
country=CA
msisdn=
isyp=0
isPremiumChat=
dob=1991-03-04
sub1=1
sub2=1
is3g=
>
<user_register.php: 2012-02-21 00:03:49
POST
username=sexhunger15
email=ho_ta
tmail.com
email_confirm=
password=vergota
password_confirm=vergota
country=CA
msisdn=
isyp=0
isPremiumChat=
dob=1991-03-04
sub1=1
sub2=1
is3g=
>
<user_register.php: 2012-02-21 00:03:50
POST
username=sexhunger15
email=ho_t@hotmail.com
email_confirm=
password=vergota
password_confirm=vergota
country=CA
msisdn=
isyp=0
isPremiumChat=
dob=1991-03-04
sub1=1
sub2=1
is3g=
>
<user_register.php: 2012-02-21 00:03:50
POST
username=sexhunger15
email=h
@yahoo.com
email_confirm=
password=**
password_confirm=vergota
country=CA
msisdn=
isyp=0
isPremiumChat=
dob=1991-03-04
sub1=1
sub2=1
is3g=
>
<user_register.php: 2012-02-21 00:03:50
POST
username=sexhunger15
email=ho_t*@hotmail.com
email_confirm=
password=ve
a
password_confirm=vergota
country=CA
msisdn=
isyp=0
isPremiumChat=
dob=1991-03-04
sub1=1
sub2=1
is3g=
>

and the other richtextbox is clear...
so that i need to do when i click Button1 It extract the email and password from multiple lines email= is Email ofcourse and password= is password

so the richtextbox will be

Email:Password

ho_t*@hotmail.com:vea
h**@yahoo.com:vergota
etc

I dont knew if its possible to do so..

I hope that someone could knew what i mean by this

I did my best to clear it so dont blame me lol

Assuming that every block contains both an email and a password, and they appear in that order, the following code will do it. It processes all lines in the control and splits each line into fields at the "=" character. The "Filter" function returns an array of string with only the lines in RichTextBox1 that contain "="

For Each line As String In Filter(RichTextBox1.Lines, "=")

    Dim fields() As String = line.Split("=")

    Select Case fields(0)
        Case "email"
            RichTextBox2.AppendText(fields(1))
        Case "password"
            RichTextBox2.AppendText(":" & fields(1) & vbCrLf)
    End Select

Next

Edited 4 Years Ago by Reverend Jim

Many thanks for the code, works perfect and nice,

Thanks again

solved.

Last question, this code works fine, but im wondering if there a faster code to split than this even with another than two richtextbox, because i load 2mb list and i took 15min to filter

Thanks again

2 mb is peanuts. You should just read it directly into an array rather than a RichTextBox. You can use Filter on an array just as easily. To read the file into an array use

Dim lines() As String = Filter(System.IO.File.ReadAllLines(filename),"=")

This question has already been answered. Start a new discussion instead.