How to extract specific link from Outlook mail body

I’m working with an auto-generated Outlook email, and I need to extract the link that appears under the “Demo2” section in the mail body. Below is a sample structure of the email content:
Some text

Demo1:
https://
Some text

Demo2:
https://
Some text

Demo3:
Https://

I want to extract only the link that appears specifically under Demo2.

Hello @akhil_n.v,

Take an assign string type named url and then in expression type this:

System.Text.RegularExpressions.Regex.Match(emailBody, "Demo2:\s(https?://\S+)").Groups(1).Value*

In emailBody pass the variable containing emailBody.

Regards,
Bharat

1 Like

Hi @bharat.c ,

While extracting body each url coming as https://example.comhttps://example.com

I have passed this text in emailBody

"Demo1:
https://
Some text

Demo2:
Preformatted texthttps://www.google.com
Some text

Demo3:
Https://"

In url I have passed this:

System.Text.RegularExpressions.Regex.Match(emailBody, “Demo2:\s(https?://\S+)”).Groups(1).Value

and I am getting the output as following: