Jump to content
Sign in to follow this  

Read text file and Split String with double dots delimiter

Recommended Posts


Hello all autoit programmers,

I have been using this code to read a text file line by line

$File = FileOpen("email.txt", 0) ; open email.txt that contain email list line by line 

If $File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
While 1
    $Line = FileReadLine($File)
    If @error = -1 Then ExitLoop

    $EmailPass = StringRegExp($Line, "(.+@.+\..+)", 1)
    If @error = 0 Then


So now i want to put the email with password using format like : stevenson77@hotmail.com:123pass

so i need to modify $EmailPass to separate between mail and pass using StringSplit or StringRegExp?

$email = StringSplit($EmailPass[0], ":")

is this ok? what the email and password variable would be? or anyone can make it look nice

$email[1] for the email ?

$email[2] for the password ?

Share this post

Link to post
Share on other sites

Give a sample of the text that's in the text file.

Share this post

Link to post
Share on other sites

Hi boshi,

let's just assume your list looks like this:


then a StringSplit($line, ":")

would result in an array:

[0] => 2

[1] => e@mail.com

[2] => pw1234

or for the second line:

[0] => 2

[1] => f@mail.com

[2] => pw1235




Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.