Marc_Engrie
asked on
Splitting an URL string containing HTTPS
Hello,
I have been using Regexp::Common in order to split a full featured URL. The only restriction is that it must be HTTP.
I am trying to split in the same way an URL starting with HTTPS but without succes. It seems that this module only support HTTP.
Does anybody knows how to split an URL starting with HTTPS into its parts the same as aove does.
Here is the (part of the ) code I use to split an URL using HTTP
use Regexp::Common qw /URI/;
my $url = defined($options{u}) ? $options{u} : "http://localhost";
my $title = defined($options{t}) ? $options{t} : "title";
$url =~ /$RE{URI}{HTTP}{-keep}/;
my $proto = $2 || 'http';
my $host = $3 || 'localhost';
my $port = $4 || '80';
my $uri = $5 || '/';
Thx in advance
Marc
I have been using Regexp::Common in order to split a full featured URL. The only restriction is that it must be HTTP.
I am trying to split in the same way an URL starting with HTTPS but without succes. It seems that this module only support HTTP.
Does anybody knows how to split an URL starting with HTTPS into its parts the same as aove does.
Here is the (part of the ) code I use to split an URL using HTTP
use Regexp::Common qw /URI/;
my $url = defined($options{u}) ? $options{u} : "http://localhost";
my $title = defined($options{t}) ? $options{t} : "title";
$url =~ /$RE{URI}{HTTP}{-keep}/;
my $proto = $2 || 'http';
my $host = $3 || 'localhost';
my $port = $4 || '80';
my $uri = $5 || '/';
Thx in advance
Marc
$url =~ /$RE{URI}{HTTP}{-scheme=>q r'https?'} {-keep}/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yep
$url =~ /$RE{URI}{HTTP}{-scheme=>q r'https?'} {-keep}/
That's the key.
Thx a lot.
$url =~ /$RE{URI}{HTTP}{-scheme=>q
That's the key.
Thx a lot.