It's a nice, a bit complex one. I'd try it as:

$url =~ m!\A(http://)?(.+?)(/.*)?\z!;
print $1 if $1;
print $2;

TIMTOWTDI.

D.

On Feb 12, 2008 3:04 PM, <[EMAIL PROTECTED]> wrote:

>
> Hi, all.
>
> I'm having a relatively simple problem, trying to trim stuff off the end
> of a URL.
>
> INPUT:
> http://www.wilbert.net
> www.worful.com/after-text.htm
> http://www.winston.com/argle.htm
> www.windoze.net
>
> DESIRED OUTPUT:
> http://www.wilbert.net
> www.worful.com
> http://www.winston.com
> www.windoze.net
>
> Presently I'm trying the code:
>
> if ($site =~ m{[^:/]/.*$}) {
>    $site =~ s{/.+}{};
> }
>
> which gives me the output:
> http://www.wilbert.com
> www.worful.com
> http:
> www.windoze.net
>
> Obviously I'm doing something wrong for the third string, but I've pulled
> out two or three hairs by now, trying to fix this.  Anybody care to take a
> shot?
>
> TIA
>
> Deane Rothenmaier
> Programmer/Analyst
> Walgreens Corp.
> 847-914-5150
>
> Put three grains of sand in a vast cathedral, and the cathedral will be
> more closely packed with sand than space is with stars. -- Sir James Jeans
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>



-- 
David Moreno - http://www.damog.net/
Yes, you can.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to