How to extract part of URL?

i have an URL similar to this one
/123/helloguys/hi/xyz.php/home
i would like to extract to this only “/123/helloguys/hi/xyz.php/”
i dont need “home” of this url…

Please suggest me some solution
THanks

If there’s always “.php” in your URL, you can extract the part with this regular expression:

.+\.php/

newURL = System.Text.RegularExpressions.Regex.Match(oldUrl, ".+\.php/").ToString
1 Like

sorry i just give an example …
actually this is my link
image
how can i avoid home part in this?

Could you provide us with more examples? Does it always ends with “/home”?

yeah all are static only numbers are dynamic it always get changed…

Then you could just replace “/home” with “” to remove it.

url = url.Replace("/home", "")

btw where to add this… i am new to this…
image
this is my work flow

Create a new Assign after Get Attribute.


i did this but what should i write in assign section? which i had added after get attribute…

image
it showing me this error

You should modify the Result variable from the Get Attribute, which looks like url001. So you need to change the assign to:

url001 = url001.Replace("/home", "")

thanks it worked <3

1 Like

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