cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StephenM
Advocate II
Advocate II

Split Body of Email, grab text before $

i need to grab the text from the body of the email that comes before the "$" symbol but i cant figure out the flow expression to use. 

 

My email body would look like this :

 

1456B$ blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 

 

I want to grab the text before the $, so in this case i need my output to be 1456B

 

I know my email will alway start with the bit of text i'm after ; there will be no spaces before or in it ; the text I want ends with $

Then the rest of the email body continues but that bit is irrelevant to me. 

 

I hope someone out there can help me please.

 

thanks !

Stephen

3 REPLIES 3
v-micsh-msft
Community Support
Community Support

Hi @StephenM,

 

I have some questions:

1. Is the 1456B$ always at the begining of the Email, without the Greeting string?

2. Is there only one $ symbol within all the Email Body?

 

We could take use of Microsoft Flow expression to deal with such a situation.

General steps should be as below:

1. Convert Email Body from HTML to Text,

2. Use Split function to analyze the OutPuts of the Convert action, then split out the string before $ symbol.

 

Split (this function will convert a whole string into an string Array) usage:

"

Splits the string using a separator. For example, this function returns ["a", "b", "c"]:

"

Function reference.

 

It would be much helpful if you could share an exact example of the Email Body.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1. Is the 1456B$ always at the begining of the Email, without the Greeting string? CORRECT

2. Is there only one $ symbol within all the Email Body? CORRECT

 

i'm aware of the split flow expression, what i was having trouble with is executing it - it kept coming up with invalid error. The Function Expression link you refer to is quite nebulous which is why i came to forum for specific advice.

 

Fortunately i have solved it on my own this evening, turns out i must use ' not " in the expression

 

there's a number of Split posts on here but none really explained it in a way i understood, so for anyone else out there here's what worked for me...

 

email trigger

convert body HTML to text

to grab the text BEFORE the # symbol :    first(split(body('Html_to_text'),'#'))

to grab the text AFTER the # symbol :    last(split(body('Html_to_text'),'#'))

 

sorted

 

Been looking for the first(split command.  Wanted to grab all of the text before the @ sign in an email address when a new email is received, the below worked a treat, thank you.

first(split(triggerBody()?['From'],'@'))
 
Gary

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,435)