cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
soylaunica
Level: Powered On

Parsing out a changing url in email body

Hello!

 

I am trying to parse out the url in the below email, the issue is that it can change based on the filetype uploaded. Additionally, this url and the line above it will not be in the email if they do not upload the optional documentation. Below find email and expression. The character count of the url is accurate up to filetype. Any recommendations?

 

Email output to be parsed:

Quote#: 1234

Quote Amt: 10.00

BU#: 1234567

Customer Email: xxxxx@xxx.com

Originator Email: xxxxxx@xx.xxxxxx.com

 

 

Please click to open quote attachment

xxxxs://xxxxxxxxxx.xx.xxxxxxxx.com/QuoteDocs/filename.filetype

 

Expression to parse out URL

if(contains(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50)),'-'),trim(replace(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50)),'-','')),trim(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50))))

1 REPLY 1
Dual Super User
Dual Super User

Re: Parsing out a changing url in email body

Hi @soylaunica 

 

since your html text contains the url in the last line

you should use the split expression to split the text by the new line character and then use last expression to ge the url

 

Post on how to split using the new line expression

https://powerusers.microsoft.com/t5/Building-Flows/Need-to-find-new-line-characters-in-a-body-of-tex...

 

result of spliturl is present

use last expression

 

last(split(-----))

this will give u ur result

 

also to check if the url is present

do indexof and check and see if it returns a valid index

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 382 members 6,083 guests
Please welcome our newest community members: