cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tobias_S
Helper I
Helper I

Split E-Mail in separate parts (split text and delimiter)

Hello community,

I need to build the following workflow.

 

An email will be frequently send to me. The mail should be converted to a wordpress post.

 

The email has a defined style. It looks like the following:

+++ Headline is here +++ Text is here ... lots

of text ... over multiple lines ... but the ending is also the same...

ending with "via automated workflow" https://shortlink

 

How can I extract the headline between "+++ " and " +++" as well as the report with in the " +++" and the https link?

I tried with composing the mail text and split it, but somehow this does not work 😞

1 ACCEPTED SOLUTION

Accepted Solutions
mattias1172
Responsive Resident
Responsive Resident

Provided the format is identical or nearly identical to the above every time, first, convert the body of the email to text using the HTML to Text action. 

 

Next, use a compose function with the "Split" expression to split at the +++. This gives an array with 3 indexes. Index 2 is your header and index 3 is the rest of the text. Expression: split(variables('Text'),'+++')

mattias1172_0-1646772280839.png

 

You can add a trim() to the expression to remove the whitespace before and after. 

 

If this part will always be at the end: "via automated workflow" https://shortlink, you can split at the text "via automated workflow" and get everything after. You may need to do a little bit of cleanup to get rid of characters and whitespace depending on how exactly it comes through via email. 

 

Expression: split(variables('Text'),'via automated workflow')[1] - (We use the [1] at the end to access that index in the array.)

mattias1172_1-1646772487183.png

 

 

View solution in original post

1 REPLY 1
mattias1172
Responsive Resident
Responsive Resident

Provided the format is identical or nearly identical to the above every time, first, convert the body of the email to text using the HTML to Text action. 

 

Next, use a compose function with the "Split" expression to split at the +++. This gives an array with 3 indexes. Index 2 is your header and index 3 is the rest of the text. Expression: split(variables('Text'),'+++')

mattias1172_0-1646772280839.png

 

You can add a trim() to the expression to remove the whitespace before and after. 

 

If this part will always be at the end: "via automated workflow" https://shortlink, you can split at the text "via automated workflow" and get everything after. You may need to do a little bit of cleanup to get rid of characters and whitespace depending on how exactly it comes through via email. 

 

Expression: split(variables('Text'),'via automated workflow')[1] - (We use the [1] at the end to access that index in the array.)

mattias1172_1-1646772487183.png

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,649)