Split String Email (varying email parts)

Hi All,

I have a string which I need to split into email parts i.e:

"Jade, Ex" <Ex.Jade@abc.co.uk>, "Scofield,Michael" (Michael.Scofield@abc.co.uk)" <Michael.Scofield@abc.co.uk>

I managed to split it okay via this:

and got the email parts extracted (two for the time being).

My issue lies if I get further people within the email string as the string can vary and I would need to create more variables to accommodate these. I would like to be able to extract all the email parts within a string like the above and have each email string separated by “;” (e.g. Ex.Jade@abc.co.uk; Michael.Scofieldt@abc.co.uk, etc) and not have to create a variable everytime as I have shown in the image above.

I was thinking of using a regex expression but I am not very familiar with this.

Any help on this matter would be hugely appreciated.

Use regex.

Import system.text.regularexpression

Use assign stage.
(Matchcoll is system.text.regualrexpression.matchcollection type variable)
Matchcoll = regex.matches(inputstring,
“<(.*?)>”)

Then just join matchcoll with;
So entire query will look like

String.Join(“;”, Regex.Matches(strText, “<(.*?)>”).Cast(Of Match)().[Select](Function(m) m.Value).ToArray())

Let me know if you need further help

Thanks @rahatadi I will try this out. I understand the first part but I am not too sure about the join?

Would you be able to setup a simple workflow, if its not a hassle?

Thanks

hi @xkarrox

here is workflow,

regex.xaml (6.1 KB)

is this what you want?

1 Like

Genius among mortals, thanks for that man

No problem :slight_smile:

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