I look in many posts for a possible answer but none of them seem to solve my problem
How to remove some part of URL by regex?
Best way to Remove the domain from url
Best way to Remove the domain from url
In Java, how do I extract the domain of a URL?
I basically will have an URL I dont know how it is. Like:
https://somevalue.google.com/something
or
www.somevalue.google.com/something
or
somevalue.localhost:8080/something
I will basically need to get rid of the domain ONLY (and not of the subdomain) with the http(s), www, .com or :8080 but seems to be more difficult than expected.
I have tried with this regex
"^(http[s]?://www\\.|http[s]?://|www\\.)"
And I was able to remove http, https, and/or www
From then I thought would be easier to add multiple combinations like adding
[\w] or `[?:*]` but seems like is not getting a proper match.
I based myself on this doc http://zetcode.com/kotlin/regularexpressions/ that explains what is for each patter but no success.
Any idea what Im doing wrong?
I dont want to get ride of the subdomain either somevalue
so, from
https://somevalue.google.com/something...
Get something like
somevalue/something....