Finding a url with regex.matches


I need to extract a URL from an email. I’m using the matches function.
There are three links in the e-mail, and I need to extract the middle one:

This is what my regex looks like, but it’s not working.

Any help?

hi @padamus7

use this regex expression


Ashwin S

Thanks for the reply, but this finds all 3 links, but I only need to extract the 2nd one.

Use varRegexMatch(1).tostring to pull out only the 2nd match

That regex still doesn’t find any URL at all.

To be more specific, the regex does find the links in a regix editor like RegExr, but it doesnt find it in my workflow.

Make sure you’re using .net regex, the syntax is slightly different than others.

If your email will always contain 2+ URLs and you always want the second one, then I’d recommend grabbing all URLs with regex and then using the second match in your workflow.

However, if you always will want the first link that contains the word MODIFY, then something similar to your initial expression would be fine.

HI @padamus7,

Try this pattern



Using @arivu96 syntax i managed to extrac this link: PitchBook

Not sure how UIPath found those numbers or .gif.
Maybe it’s because I’m not using .net regex?
How do I switch to it @Dave ave ?

arivu96’s solution is grabbing everything starting with http and grabbing all non-whitespace characters in between.

The link you just said was extracted wasn’t even found above in the sample provided?

If your links don’t have spaces in them, a simpler solution to grab all URLs could just be (http)\S*

This is looking for the words http, then grabs all non-whitespace characters. However, if the URL shows spaces instead of %20, then it won’t work and you should use arivu96’s solution instead which seems to be doing some more fancy stuff I don’t feel like parsing right now haha

Thank you everyone for helping out. Turns out there was another link that I missed, so I just had to change matchesfound(1) to (3).

I ended up using this regex: (http)\S* as the e-mails are always the same and the number of links are the same.

1 Like

@Dave I decided to optimize my workflow to not find all links and open the 3rd one, as that’s not very reliable if number of links change.
I need to open a specific link containg the phrase ‘view_all’
I came up with this regex, which works in
Unfortunately, in UiPath, it opens a bunch of tabs with single words such as ‘want’ or ‘to’, and then it finally opens the link, but with extra characters:
If anyone could help I would greatly appreciate it, I’ve been struggling with this for a good few days.

I’ve also tried this regex


but it produces the same result