How to find URL with Regax

Hi,
If URL is divided into 2 parts then how to capture URL in uipath

Hi,
image

my URL is divide in 2 parts
can we find 2 values from regex in uipath

Hi! Welcome to community!

try this:

System.Text.RegularExpressions.RegEx.Match("YourInputString","(https?:\/\/.*\b)")

Regards,
NaNi

Hi!

Could you please send us the expected output?

Regards,
NaNi

can you tell us the output you are expecting here @Sweety_Nagar

Hello @Sweety_Nagar,

Do you need to get the whole url? If so, try this:

system.text.regularexpressions.regex.match(strvariable, “(https:)(.?)+”).Value.ToString

Otherwise, if you would need to split the url, maybe the best way is using string manipulation such as split method.

Regards :slight_smile:

Hey @Sweety_Nagar

If you want to learn Regex - check out my Regex MegaPost

Cheers

1 Like

Hi,
image

when i run robot for each row i get URL by 2nd method i have written this regax for one URL but kru how to write regax for 2nd URL i don’t understand
Can we write 2 expressions in a single regex
To find 2 different values

my regax expression

image

this is my url in this image

Hi!

No need to use 2 regex. simply use pipe line ex:- System.Text.RegularExpressions.RegEx.Match(“YourInputString”,"(https?://.*\b)|SecondRegEx")

This will work

Regards,
NaNi

image

What regex to write for this
From https to me. com and then till 6a2 the value

Whether to write in this assigned activity or in regex

In Assign or MessageBox.

If you wants to use is matches activity you can also use that pipeline

Could you please paste that text here as an text not image!

Regards,
NaNi

If you put this:

system.Text.RegularExpressions.Regex.Match(url, “(https:)(.?)+”).Value.ToString.Split("<"c)(1)

Where (1), it gives the second part of the url, if you put (0) it gives you the first part of the url

Is it useful for you in this way?

Hi!

try this

System.Text.RegularExpressions.RegEx.Match("YourInputString","(https?:\/\/.\S+(?=<)|(?<=> > )\S+)")

Reference:

This is working for me. Let me know if you’re facing any difficulty.

Regards,
NaNi

Hi
I am using this method
and i am write 2 regax in one Matches , but i ma facing this issue

image

I am write both regax for 2 value

Use the above expression which i provided.

This will only work when you have first and second logic should be used which i provided

Regards,
NaNi

Hi @Sweety_Nagar

Here is the workflow

Sequence.xaml (11.4 KB)

Regards
Gokul

2 Likes