Best way to check if a string is a URL?

I have a lot of strings. Some are url addresses and others are not. What is the best way to decide in UiPath? At the moment I am doing something like this:

if string.Substring(0,6).Contains(“http”)

Is there a better way?

1 Like

Hi,

A stronger approach would be Regex (Regular expressions) or Is Match activity is quite nice skill to have for different other things.

Here is a pattern which should work for it.

(http|https):[^\s]*

Cheers

3 Likes

Awesome! Is “Is Match” the only option for regex in UiPath? “Is Match” seems perfect for my problem, just wondering if there are other Regex type activities I should know about.

Hi,

Yes this is the equivalent, you also have the Matches activity which is the equivalent of Regex.Matches() method.

Cheers

1 Like

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