Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Perl RegEx (url explode)

by aitap (Deacon)
on Nov 02, 2012 at 18:54 UTC ( #1002024=note: print w/ replies, xml ) Need Help??

in reply to Perl RegEx (url explode)

Isn't URI better in this case? Bigger, but simpler code:

use URI; for (URI::->new($conf[1],"http")) { my @domain = split /\./, $_->host; my $tld = pop @domain; my $sld = join ".",@domain; my $www = @domain > 2 && $domain[0] eq "www" ? shift @domain : ""; my $host = join ".",(@domain,$tld); print ($_->scheme,$www,$host,$sld,$tld,$_->port); }
(this code will work even in weird cases like perfectly valid
Sorry if my advice was wrong.

Comment on Re: Perl RegEx (url explode)
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002024]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-11-25 23:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (693 votes), past polls