469,890 Members | 2,164 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

Email Validator needs to allow dash

I found the following email validation code in the newsgroup and it works great except it won't allow a dash in the name. I do not understand regular expressions so I'm unsure of how to fix it.

Can someone who understands regular expressions tell me what needs to be changed to allow a dash in the email name

public static bool IsValidEmailAddress(string sEmail

if (sEmail == null

return false

els

return Regex.IsMatch(sEmail, @

[-a-zA-Z0-9][-.a-zA-Z0-9]

[-.a-zA-Z0-9]
(\.[-.a-zA-Z0-9]+)
\

com|edu|info|gov|int|mil|net|org|biz
name|museum|coop|aero|pr

[a-zA-Z]{2

$",
RegexOptions.IgnorePatternWhitespace)

}
Nov 15 '05 #1
0 1080

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.