Link to home
Start Free TrialLog in
Avatar of Marc_Engrie
Marc_EngrieFlag for Belgium

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
Avatar of ozo
ozo
Flag of United States of America image

$url =~ /$RE{URI}{HTTP}{-scheme=>qr'https?'}{-keep}/
ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marc_Engrie

ASKER

Yep

$url =~ /$RE{URI}{HTTP}{-scheme=>qr'https?'}{-keep}/

That's the key.

Thx a lot.