Jump to content

Problem on splitting string


Recommended Posts

I have a string that can contain a email address, 2 email address(es) or even 3 email address(es)

this is the example of the string:

abc@abc.com

or

abc@abc.com / xyz@xyz.com

or

abc@abc.com / xyz@xyz.com, aaa@aaa.com

A character that separate those address(es) is either / , or ;

How the separate them into $email_adress[1], $email_address[2], $email_address[3]?

I know that StringRegExp should do, but... how?

Thanks a lot!! :mellow:

Link to comment
Share on other sites

StringSplit will work for you.

Something like:

#include <array.au3>

$string = "paul, bob; jack/bill"
$array = StringSplit($string,",;/")
_ArrayDisplay($array)

For $x = 1 to $array[0]
    $array[$x] = StringStripWS($array[$x], 3)
Next
_ArrayDisplay($array)

Edit: Added the StringStripWS() loop, which you may or may not need.

Edited by Spiff59
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...