cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeOMilla
New Member

Return last word from string / How to split without second delimiter

Hi there, I'm facing this problem, and cannot figure out the solution.


I'm having an email like this:

 

Acronym: ABC

Manager: Name Surname

Email: name.surname@company.com

Comment: Some dummy text

 

From this email I want to extract text which I can do like this

ACRONYM - trim(first(split(last(split(outputs('Convert_Email_Body_to_Text')?['body'], 'Acronym:')), 'Manager:')))

MANAGER - trim(first(split(last(split(outputs('Convert_Email_Body_to_Text')?['body'], 'Manager:')), 'Email:')))

 

For acronym I'm looking for everything between "Acronym:" and the "Manager:", and so on, but for the "Comment:" I'm confused what to do because I cannot use split function since I don't have the second parameter.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Try:

trim(last(split(outputs('Convert_Email_Body_to_Text')['body'], ':')))

View solution in original post

3 REPLIES 3
Paulie78
Super User
Super User

Can you not just do:

trim(split(outputs('Convert_Email_Body_to_Text')['body'], 'Comment:')[1])

I don't think you need a second parameter as it is the end of the text.

 

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

@Paulie78this cannot be evaluated because array index '1' is outside bounds (0, 0) of array.
It is not working like that. I'm looking for other solutions, to get the text after the 4th occurence of ":" or something like that.

Try:

trim(last(split(outputs('Convert_Email_Body_to_Text')['body'], ':')))

Helpful resources

Announcements
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 tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,462)