Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Email validation using Regular Expression

0 views
Skip to first unread message

seash

unread,
Feb 25, 2004, 8:26:04 AM2/25/04
to
Hi
i need to validate a textBox.text containing a email address.
the enterd email address text into the textbox needs to be validated for correct format
example : x...@abcd.com
how to validate whether a string or text enterd into a textBox is a valid email format r not?

-----------need help
-------seash

Lafayette

unread,
Feb 25, 2004, 8:33:09 AM2/25/04
to
look at www.regexplib.com
hope it helps
[]愀
Lafayette


"seash" <anon...@discussions.microsoft.com> wrote in message
news:EBF05F40-5D7F-4FBB...@microsoft.com...

Tom Porterfield

unread,
Feb 25, 2004, 8:43:20 AM2/25/04
to
seash wrote:
> Hi
> i need to validate a textBox.text containing a email address.
> the enterd email address text into the textbox needs to be validated
> for correct format example : x...@abcd.com
> how to validate whether a string or text enterd into a textBox
> is a valid email format r not?

The ASP.NET RegEx validator has some predefined validations. For internet
e-mail it has the following regex:

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
--
Tom Porterfield
MS-MVP MCE
http://support.telop.org

Please post all follow-ups to the newsgroup only.


N.K

unread,
Feb 26, 2004, 2:58:12 AM2/26/04
to
Heres the one I use, I got it from
http://www.breakingpar.com/bkp/home.nsf/Doc?OpenNavigator&U=87256B280015193F87256C40004CC8C6


string regex = @"^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$";


Cheers
Nirmal

0 new messages