Splitting multiple string within on excel cell

Hello,
i’m trying to iterate through a list of values in an excel cell and extract the email from each user. below is an example of what it looks like.

i’m able to grab the email from the first line in this example as it is only a basic split to grab the single email. my question is what logic do i use if sometimes i have 2 or 3, etc…?

i tried splitting on the “;” but don’t know what to do next with the array to be able to grab all of the emails. i also need to take those emails (for example, if there are 3 in a single line) and attach them to a single email to send to that whole group.

FYI, on the first example, i split on " " to isolate the email address and used a substring value to remove the brackets on either side.

find some starter help here:

@chris.dease

You can as well try with split

Emailarray = Str.Split(";"c).Select(function(x) x.Trim.Split({"<",">"},StringSplitOptions.RemoveEmptyEntries).Last).ToArray

Emailarrqy is a stringarray variable which will store all emails

Cheers

is there a particular package i need to install? i’m getting BC30456 error that Regex is not a member of System.Text.RegularExpressions

Hi Chris,
Please find the better solution as mentioned below.
Kindly let me if it works & like.

ManageString = str.Replace(“;”,“”).split(" “c).ToArray().ToList().Where(function(fx) fx.ToString.Contains(”<“) or fx.ToString.Contains(”>")).ToArray().ToList()

Cheers…

@Anil_G,
This method is working. Could you possibly tell me how to implement this array into the send outlook message activity? Can i put the array Variable into the “to” field? Or, do i need to somehow make it into string? can i just add it as “EmailArray.ToString” and it will add all emails in the array to that field?

image

@chris.dease

You can make it to string by using below

String.Join(";",arrayvariable)

Cheers

so i can do an assign statement like:
StringVariable = String.Join(“;”, arrayvariable)

Then add StringVariable to the “to” field of the send outlook activity?

@chris.dease

Yes or else you can directly give this statement in to field as well

Both would work

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.