How to get mail message body in regex and then use the regex output in browser?

How to get the mail body and get the link from it (which includes 2 link but need to get the 2nd link) . use that link to download file.

Thanks

Hi @pari_patel

Can you share the input text and expected output what you want to extract

Regards

Hi, I have email contain URL link embedded in some text (Product Feed). Need to download that product feed File.

Hi @pari_patel

Can you share the text please.

Regards

@pari_patel

Get the mail body as html save the html text to text file as .html file

Open using use app/browser and use get attribute activity with selector as <webctrl tag='A' idx='2' /> and attribute would be href

Or use this get the second value in matches (?<=href\="").*(?="")

Cheers

I tried that way. I am not getting the entire URL . I am just getting that text “Product Feed” in the .html file.

But If I try to get that in log message, I am getting the URL behind that product feed text.

Probably easiest to use the body TEXT, not HTML. Show us what that body text looks like. It should just contain the raw http links and then the RegEx will be simple.

@pari_patel

Are you using. Href? Can you show the html text..also i provided the regex above

Cheers

the email text sample is :

Site Information
[https://sdjfjdedevjkdejv/dc/cvdf-logo.jpg]

Product Feed<https:// This link is for the file>

This message …contact us

Hi @Anil_G I am trying with regex but having some trouble. I mentioned the sample text from log message which I am getting.

I am using for each email and variable to store the emailbody .

Hi @pari_patel

Try this regex:

System.Text.RegularExpression.Regex.Match(strInput, "(?<=Product Feed\<).*(?=\>)").Value.Trim()

Hope it helps!!

1 Like

@pari_patel

Please try (?<=Product Feed\<).*(?=\>)

Cheers

1 Like

Hi , @Parvathy and @Anil_G both of your regex expression is working thanks for the suggestion but now How Can I use that link to download file ? Just put it in app browser ? Thanks

Hi @pari_patel

Use Use Application/Browser activity and pass that variable and it will downlaod a file.

Regards

@pari_patel

You can use http reqquest and pass thr url in uri field and give a filepath in output filepath where you want to save the file..that should work

Cheers

1 Like

Ok, This says string not convert into UiElement.

This is working. Thanks @Anil_G

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.