Re: Split domain from email add by Ray
Ray
Mon Jul 28 11:54:38 CDT 2003
sDomain = Split(sEmail, "@")(1)
That will split the var at @ and grab the second element. You'd want some
error trapping though or some sort of validating. Like, if I put in
ray@domain@otherdomain.com, my domain would come back as "domain." Some
would say that you should grab the ubound of the array, but with that, my
domain would come back as otherdomain.com. While that seems right, it
doesn't matter, because the e-mail address is invalid. AFAIK, there a valid
e-mail address cannot have any number of @ symbols but 1. So, you may want
to use ubound while validating the address or something, but after it's
validated, you could just grab the second array element (1).
Ray at home
--
Will trade ASP help for SQL Server help
"Nev Simms" <nsimms@smi-online.co.uk> wrote in message
news:096b01c3551e$80284b10$a601280a@phx.gbl...
> Hi,
>
> I need to extract the domain from any email address
> entered into my form.
>
> e.g. for someone@somewhere.com i want to be able to take
> the string and extract only the somewhere.com part to pass
> into a function.
>
> Can anyone please advise me of the best way to do this.
>
> Thanks in advance,
> Nev.