cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PatrizioB
Regular Visitor

How split a string with email addresses into an array

Hi , i need to extract the email addres into a string like that

"tom@contoso.com, joe@acme.net, tim@contoso.com"

into an array 

{

tom@contoso.com

joe@acme.net

tim@contoso.com

}

in order to apply a for each on the array

 

Any help is very appreciated, thank YOU!

 

7 REPLIES 7
VictorIvanidze
Memorable Member
Memorable Member

sorry, i've written too "simple" my question..

I need to extract all the recipient from a "export mail V2" function .

I have to get all the chars after "To: " , extract only the email address and put them into an array

Can you help me ?

 

VictorIvanidze
Memorable Member
Memorable Member

Could you show your flow?

PatrizioB
Regular Visitor

1) found the index of "To: "from the export mail

iniziorigagrezza = indexOf(outputs('Export_email_(V2)')?['body'],'To: ')

2) get 2500 chars from the "To: " rigadest = substring(outputs('Export_email_(V2)')?['body'],variables('iniziorigagrezza'),2500)

3) remove the "To: " from the string rigadestpulita = replace(variables('rigadest'),'To: ','')

4) i'm there ... I need to find a way to extract only emailaddresses from "rigadestpulita"

 

thank you

 

VictorIvanidze
Memorable Member
Memorable Member

Why did you decide that 2500 is the right length of substring?

You have to find first CRLF combination after To: to get the string of addresses.

After that you can use split function to get the array.

ok i've fixed the 2500 char issue and set it to CRLF , now how can i split from a string like that ? 

"nadya.volk@crvd.net, Tom Pat <tom.pat@crvd.net>"

 

 

 

 

VictorIvanidze
Memorable Member
Memorable Member

Initialize the variable of type array with this expression:

split(variables('var1'),',')

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (43,607)