How to get domain name from URL?


#1

For example, I have this URL

https://www.example.com/a/c/d/e/g

and I only want

example.com

How to do that?


Here’s what I did