Get domain name from URL
How to Get host domain from URL?
A URI (uniform resource identifier ) is a representation of a resource available to your application on the network. You can retrieve host of a url by using Request object or Uri.
Get domain name of a url
Or u can parse the url using regex
How to parse a domain from URL?
How to get domain part from URL
Extract domain name from URL
A better way you could go without the need for regular expression or parsing is to use the below code.