I tried to extract the Only URL part not the Path, for example
if the url is https://example.com/news/cricket
the output should be https://example.com/
but i am not strong on regular expression.
data = "https://example.com/news/cricket";
var name = data.substring(0, data.lastIndexOf("/"));
console.log(name);
this is what i have tried but output is:-
https://example.com/news
Expected output is
https://example.com/
Thank for healping guys