Using Matches Activity to get one link

Hi, anyone out there who could help,
Basically i used the Matches activity to read the link in outlook mail. But there are multiple link inside the outlook mail where else i would only need to read the first link and paste it in the browser. But how do i do only read the first link in outlook mail?

Hey @monicaong0609 ,

Matches activity return the result in I Enumerable format, you can get the first result from that collection using Result(0).

Thanks,
Sanjit

Hi thank you so much for your quick response but may i know how do i do that? Where do i write result(0) at ?

Welcome @monicaong0609 to the UiPath community forums

Once you have your Email body as a string check out my Regex megapost :blush:

Cheers

Steve

The output of matches activity, in your case Result=Link. I have written the result for reference only.

@monicaong0609

If you are sure that only one result is there…then remove the second for loop and where ever you need to use the link extracted use link(0).Value

If you get multiple links and you want all then have the loop as is…change the type argument to regex.match

and then use currentitem.Value inside the loop and for each iteration you will get one link

Hope this helps

cheers

Hi @monicaong0609 - Assume the output variable of Matches activity is Result, now within the inner loop take message box as Result(0).ToString to make sure it is giving the right data

Now, you can use Type Into or SetText activity, to write the link in the browser or if you just want to open that link in the browser, you can use Open Browser activity

Once you write the data in the browser, use break activity to come out from the loop as you’re done processing the first link.

This works! Thank you so much!!

@monicaong0609 - Great!! If you don’t have any other queries, please close this topic by selecting the appropriate solution. This would help others facing the similar issue.

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