Re: [MacPerl-AnyPerl] Filter a url

[email protected] (John Delacour) Fri, 5 Nov 2004 17:57:44 +0000
Newsgroups perl.macperl.anyperl
Message-ID <p06200703bdb16bec8303@[10.0.0.1]>
At 1:48 pm +0100 31/10/04, Eelco Alosery wrote:

>I want to filter a url from $ENV{'HTTP_REFERER'}
>If the url is http://www.testdomein.nl/test.html
>I only want a result testdomein.nl
>
>I have been testing whit this script
>$url =~ s/.*?\.(.+?)\/.*?/$1/is;
>
>It delets the first part of the url corect, but after .nl it deletes 
>the slash and not the remaining tekst.
>The result is testdomein.nltest.html
>
>What is it i do wrong.


Try something like this:

$_ ="http://www.testdomain.nl/test.html";

s~  [^\.]+.  ([^/]+)  /.+  ~$1~x;

print "$_$/";


JD