[Webinar] Streamline your web hosting managementRegister Today


Splitting an URL string containing HTTPS

Posted on 2008-01-29
Medium Priority
Last Modified: 2010-03-05
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

Question by:Marc_Engrie
LVL 85

Expert Comment

ID: 20772389
$url =~ /$RE{URI}{HTTP}{-scheme=>qr'https?'}{-keep}/
LVL 39

Accepted Solution

Adam314 earned 1000 total points
ID: 20772675

Author Comment

ID: 20775179

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

That's the key.

Thx a lot.


Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question