RegEx Match for list of links

Hi, I have a bot that grabs links and saves them in a txt file.

What I want, is to check if the link already exists inside that txt, so it won’t get added again.
This is how the txt looks inside

I made the next RegEx inside the page


As you see, it is matching exactly what I need. The problem comes when I try to use that expression in UiPath.

The link that will save in the txt (and thus the one that I want to check) comes inside a string variable, and inside the variable the format is exactly this one
As you see, I’m scaping the “/” characters due to the RegEx Match.

This is the RegEx Match that I’m using

System.Text.RegularExpressions.Regex.Match(strTxt, strLinkToCheck).Success

The variable “strLinkToCheck” contains


The variable “strText” contains

The problem is that it always returns false inside UiPath when I run it. Doesn’t matter if the link is inside the txt or not, it always returns false.

Can anyone help?. I’ll will appreciate it.

selecting this case we would not work stringVar.contains method as it would wrongly match:

as an alternate pattern you can try:
Pattern with escaped dot:

as alternate approach (we assume each line = 1 link) you can try:
isFound = File.ReadAllLines("YourFilePath").Any(Function (x) x.Trim.Equals("YourLinkString"))

1 Like

I just tried your solution and using boundaries \b and scaping the dot, it works.

Thank you!

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