This regex by Rob is working alright, but can't follow exactly how it
truncates an absolute url from first character to the one before the
dot.

It returns (.domain4you.com from http:://www. domain4you.com.) exactly
what is expected, but I can't easily understand it.

Please I'm not pulling anyone's leg. So just explain it if you can.

 (.domain4you.com from http:://www. domain4you.com.) 


foreach (@domains) {
  my $name = $_;
  $name =~ s/^[^\.]+//;
  print $name;
}


-----Original Message-----
From: B. Fongo [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 7:29 PM
To: [EMAIL PROTECTED]
Subject: Regex to match domain for cookie


How do I match a domain name starting from the dot? 
 
# Match something like these
".domain4you.co.uk"
".domain-house.de"
 
 
This is what I have:
 
 
@domains = ("http://www.domain.com ", "http://www.domain4you.co.uk  
        "http://www.domain-house.de"; "https//rrp.cash-day.com"
      );
 
 
foreach (@domains){
 
            $_ =~ /^\D ([\.A-Za-z0-9]+[\.\D])$/; # What is wrong here?
# Need ".domain.com", but I get "ww.domain.com"
            $x = $1;
            print "$x";
 
 
}
 
 
 
Babs
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to