I want to extract the domain name from the url. For example for www.Edmunds.com/Toyota_Camry_Hybrid
or http://jido.com
I want to have www.Edmunds.com
and jido.com
I have written the following regular expression:
Regex.Replace(Url, @"^([a-zA-Z]+:\/\/)?([^\/]+)\/.*?$", "$2");
It works fine for the first link but for the second link I get: http:
Could someone please help me with this?