How do I extract the domain out of an URL? Is there a Perl Module? I could not find any.
Use ICANN Lookup The Internet Corporation for Assigned Names and Numbers (ICANN) is a non-profit organization that collects domain information. Use the ICANN Lookup tool to find your domain host. Go to lookup.icann.org. In the search field, enter your domain name and click Lookup.
Extract the Hyperlink URL with a Click You can then copy and paste the URL from the browser address bar back into Excel. Highlight the URL and press Ctrl + C to copy, then go back to Excel and press Ctrl + V to paste the URL into a new cell.
Firstly, we'd need to extract the host from the given URL value. We can use the URI class: String urlString = "https://www.baeldung.com/java-tutorial"; URI uri = new URI(urlString); String host = uri. getHost();
The URI module can parse URIs for you in a nice OO-ish way. To get the domain part:
my $url = URI->new( "http://www.stackoverflow.com/" );
my $domain = $url->host;
print $domain;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With