Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Notice that I get the URL out, but if it's just a plaint http://www.url.com without a trailing slash it gets an error.#!/usr/bin/perl -w use strict; my $displayed_link = 'http://www.url.com/cgi.pl?x=y'; ( $displayed_link ) = $displayed_link =~ m/^(http:\/\/.*?\/)/; print $displayed_link . "\n";
I've tried a bunch of ways to have it come out with "http:www.url.com" or "http://www.url.com/" regardless of the input but can't figure it out.#!/usr/bin/perl -w use strict; my $displayed_link = 'http://www.url.com'; ( $displayed_link ) = $displayed_link =~ m/^(http:\/\/.*?\/)/; print $displayed_link . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Question
by ikegami (Patriarch) on Jan 04, 2009 at 06:27 UTC | |
by Anonymous Monk on Jan 04, 2009 at 06:33 UTC | |
by Corion (Patriarch) on Jan 04, 2009 at 09:33 UTC | |
by ikegami (Patriarch) on Jan 04, 2009 at 06:35 UTC | |
by Anonymous Monk on Jan 04, 2009 at 06:42 UTC | |
by ikegami (Patriarch) on Jan 04, 2009 at 06:44 UTC | |
by Anonymous Monk on Jan 04, 2009 at 06:43 UTC | |
by ikegami (Patriarch) on Jan 04, 2009 at 06:49 UTC | |
| |
|
Re: Regex Question
by GrandFather (Saint) on Jan 04, 2009 at 07:04 UTC | |
|
Re: Regex Question
by BrowserUk (Patriarch) on Jan 04, 2009 at 07:01 UTC | |
|
Re: Regex Question
by Anonymous Monk on Jan 04, 2009 at 06:24 UTC | |
|
Re: Regex Question
by Anonymous Monk on Jan 07, 2009 at 16:42 UTC |