cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

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
Highlighted
Community Support
Community Support

Re: Split Body of Email, grab text before $

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.
Highlighted
Advocate I
Advocate I

Re: Split Body of Email, grab text before $

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

 

Highlighted
Helper III
Helper III

Re: Split Body of Email, grab text before $

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,531)