How to split large string with emails in an array?


The following was the user requirement.

The question was the user had the weird string stored in the Multi People Picker Field.


If you look closely at the sample string the “i:0#|membership|” is prefixed before all the emails. The question is how to get just emails with the array of emails. For a developer, it may not be difficult. But for a no-code citizen developer, it will be tricky. This blog post will explain step by step how to extract emails by using two string functions “concat” and “split”.

For other function reference, please book mark url

Step by Step Solution

Step # 1 Create a manually triggered flow with a Var1 variable.

Step # 2 Now we will add compose to split the string by ‘;’ (semicolon) character.

split(variables('Var1'), ';')

The above expression will provide the following output.


Step # 3 Iterate over the above compose output and split the each item in array on a pipe character ‘|’.

split ( item(), '|') [ 2 ]

The above function will split on a pipe character for each items in the array.
e.g. for "i:0#|membership|" the out put will be
just email i.e. "".

First the split will create and array as
after that we are selecting the third element of the array. Note: the array is zero indexed so the third element will be 2.

NOTE: The final Compose “FinalArrayOfEmailsCompose” outside of the Apply each is a trick for collecting all values in the array.

The trick is make sure you are using inner loop’s compose as an input to it. Like following


So when workflow runs the output of the final compose will look like the following.


The final output is converted to required array with emails. Also we looked at the technique of Compose outside of Apply Each and collecting Compose values defined in the loop.

About Pankaj

I am a Developer and my linked profile is
This entry was posted in Power Automate. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s