Regex Is Match Activity Not Working

I have been trying to use the Is Match activity to match a URL. It is finding the match on a regex tester website but it will not find the same exact match on the website that I am searching.

I do not want to post the entire URL because it contains some sensitive company information, but essentially I am trying to find this URL:

https://connect.com/Teams/11840/Supplier Repository/Supplier/Purchase Order/123456/123456 Supplier Signed PO.pdf

Using this regex:

https://connect.com/Teams/11840/.*/123456/(123456 Supplier Signed PO.pdf)

The .* is used to match any characters in between the two backslashes. The parentheses is to group the final portion together. Like I said, this is working in a regex tester but not using the UiPath Is Match activity.

Does anybody have any suggestions? Thanks

@jpreziuso

Is this dynamic url?

@jpreziuso

Please show how you are using in IsMatch

cheers

What do you mean by dynamic exactly?

There isn’t much to show. I am using the Regex I stated as the Pattern and the URL as the input. I have turned on IgnoreCase and Compiled. I have also separately tried turning on MultiLine and IgnorePatternWhitespace but nothing has worked

This is input :

https://connect.com/Teams/11840/Supplier Repository/Supplier/Purchase Order/123456/123456 Supplier Signed PO.pdf

Output will be

matches for below text:

Supplier Repository/Supplier/Purchase Order

can you confirm?

@jpreziuso

I asked it because I used same and result is as expected

Also worth checking the url if it contains any encodings maybe instead of space you might be getting %20 etc…This might be a reason the pattern is failing

cheers

I don’t think so. But I am not sure exactly what you are asking, I’m sorry

The spaces are appearing as %20. How can I account for this? Shouldn’t IgnorePatternWhitespace handle that?

@jpreziuso

URL encoding does not come under that

You can decode the url and compare

system.web.HttpUtility.UrlDecode("Yoururl")

cheers

This fixed the issue. Thank you!

1 Like

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