Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert mail.yahoo.com into yahoo.com? 1

Status
Not open for further replies.

Digitalcandy

IS-IT--Management
May 15, 2003
230
0
0
US
On MS SQL 2000, I have a field that stores host names from Microsoft ISA logging. I want to pull out the domain name portion of the host for .com and .net domains only.

Sample data would end up looking like so...


US.f840.mail.yahoo.com --> yahoo.com
--> yahoo.com
configure.us.dell.com --> dell.com
webmailb.netzero.net --> netzero.net




I know for other countries, things get complicated, so that's why I'm only concerning myself with .net and .com hosts.
 
//@Host_Names
local stringvar input := "US.f840.mail.yahoo.com";
local stringvar array url_parts := split(input,".");

if ubound(url_parts) > 1
then join(url_parts[ubound(url_parts)-1 to ubound(url_parts)],".")
else ""

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top