Extract Link from Email body, Please help

Hello Guys,
I Hope you are well.

I get emails in this format as a forward email:

I want to extract the link using regex and then to click it later on activities.
Can it be done using REGEX?

The Complete text is, i need the first Link:

"From: noreply@total.com nepasrepondre-AirTotalDemat@infosae.docapost-dps.com
Sent: Mittwoch, 25. August 2021 00:27
To: GlobeAir Accounting accounting@globeair.com
Subject: [faked-from] Votre Facture 9276946248 est disponible ! Your invoice 9276946248 is ready !

 <http://www.edocuweb.net/ressources/images/ATI/ATI.gif> 

Dear Customer,

Please find included the invoice N° : 9276946248 dated 23/08/2021 00:00:00

To retrieve your invoice please just click on the jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 https://www.edemat.net/AIRTOTALDEMAT-PROD/ondemand/dl.asp?jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 ">link https://www.edemat.net/AIRTOTALDEMAT-PROD/ondemand/dl.asp?jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 (warning : this link is available only for 3 months)

PS : This message is automatically generated. Please don’t answer.

Cher Client,

Veuillez trouver ci-joint la facture N° : 9276946248 date de facturation 23/08/2021 00:00:00

Vous pouvez la consulter en suivant ce jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 https://www.edemat.net/AIRTOTALDEMAT-PROD/ondemand/dl.asp?jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 ">lien https://www.edemat.net/AIRTOTALDEMAT-PROD/ondemand/dl.asp?jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7 (attention : ce lien n’est valide que 3 mois)

PS : Ce message est généré automatiquement. Merci de ne pas y répondre.

Ce message et toutes les pièces jointes sont confidentiels et établis à l’intention exclusive de leurs destinataires. Toute modification, édition, utilisation ou diffusion non autorisée est interdite. Air Total International SA décline toute responsabilité au titre de ce message s’il est altéré, déformé, falsifié ou encore édité ou diffusé sans autorisation. Si vous avez reçu ce message par erreur, merci de nous en avertir immédiatement et de le détruire.

This message and any attachments are confidential and intended solely for the addressees. Any unauthorized modification, edition, use or dissemination is prohibited. Air Total International SA will not be liable for this message if altered, changed, falsified, edited or diffused without authorization. If you have received this message by mistake, please notify us immediately and delete it

http://infosae.docapost-dps.com/Go/index.cfm?WebGif=1&WS=14454164_9404429&WA=69

I am using this Regex.
It has 6 matches.
How can i select the third match of of these matches?

Hi Hurmet!

Use the Matches activity and configure it with Input string and Regex pattern. Create a variable for the Output collection (IEnumerable).

You can get the string value of the third Match with MatchesCollection(2).ToString since it has a 0-based index

Best,
Lukas

please let us know, what is the exact link you would like to extract from the email body?

1 Like

Thank You for your answer.
I did just that.
In Regex builder online it is valid.
here it generates an empty collection.

The link i want is like this:
https://www.edemat.net/AIRTOTALDEMAT-PROD/ondemand/dl.asp?jt=d310183c19946262d83ebbe4c57813d33aee4c4e6c713a808e041c0ec68598a4cd8296da2552e14f9858305d9cae01f727378802df543ac54a26fdc07d942912cdfb87020a9542217095d9665120f2e7

/gm is not part of the expression! It only represents the RegexOptions used when compiling

1 Like

this one solved my problem:

Then i got the third result.
It was the link I wanted.

Thank you guys

1 Like

@Hurmet_Noka - Please check this…

 \S+(?=\s+\(warning : this link is available only for 3 months\))

It didn’t work…I solved it using Matches activity and in configuration i just select URL, and i chose any or more and then i select the third link.

Thank You
Regards

H.Noka

Please show us what you tried and what did not work??

Please see below…

1 Like


It gives some extra <>

Hmm…strange…In the text which you gave I didn’t find the tags…

but no worry…just write as below

ResultLinks(0).tostring.replace("<","").replace(">","")
1 Like

Now it works.
thank You so Much

1 Like

Please Note: Assumption is that, you always receive the above text, if you don’t then this regex won’t work…

1 Like

Its always there :slight_smile: Thank You

1 Like

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