In article <[EMAIL PROTECTED]>, Mark
Anderson wrote:
>> We have a fairly simple redirect script a url is entered, and even tho
> there are
>> directions to not enter the "http://www" sometimes we get it or
> "http://"...
>> what is the simplest method to extract just the domain name if a
>> "http://www.somedomain_name.com" or "http://somedomain_name.com" is enter
> so we
>> can extract just the "somedomain_name.com"
>
> $domain =~ s{^(http:(//)?)?(www.)?}{};
And this second substitution seems to work to strip subdirectories
(www.abc.com/catalog/):
$domain =~ s{(/.*/?)?$}{};
To combine them I'm guessing one would have to capture the "middle":
$domain =~ s{^(http:(//)?)?(www.)?(.*)?(/.*/?)?$}{};
print "$4\n";
(It works on my small example at least)
-K
--
Kevin Pfeiffer
International University Bremen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]