McKirahan wrote on 05 feb 2006 in
"Scott" <sb*****@mileslumber.com> wrote in message I need to get the userName from an Email address. For example, if the
email is us******@cnn.com, how can I can I get just the "username"
part using the
RIGHT() or LEFT() functions?
Const c = "us******@cnn.com"
Dim a
a = Split(c,"@")
Response.Write a(0)
or in ASP-jscript
var c = "us******@cnn.com";
response.write( c.split('@')[0] );
or
Dim s
s = Left(c,InStr(c,"@")-1)
Response.Write s
or use a ASP-vbs regex:
c = "us******@cnn.com"
Set regEx = New RegExp
regEx.Pattern = "@.*"
Response.Write regEx.Replace(c, "")
or a ASP-jscript regex:
var c = "us******@cnn.com";
response.write( c.replace(/@.*/, '') );
There are many ways to reach Rome:
you can take a scenic route or a fast one,
relying on classic Basic Left() and Right() could be
the OP's preference though.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)