Validatiom email

Someone know where hava a example og validation of email.

Thank you!

[109 byte] By [LeandroRodrigues] at [2008-2-16]
# 1

What are you hoping to validate, an email *address*, or something else ? Regex to validate email addresses are pretty common, I think expresso even has one built in.

cgraus at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...
# 2

I'm needing that when I client put or email in my form my system talk to me If or email is true else false. Only it!

Thank you a lot! again

LeandroRodrigues at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...
# 3

This is the regex for email addresses in expresso:

([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})

So something like

if (Regex.IsMatch(string, @"([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})"))

will return true if string is an email address

Don't forget to put using System.Text.RegularExpressions;

cgraus at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...

.NET Development

Site Classified