473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 1199

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Craig Bailey | last post by:
I've been using this pattern to verify email addresses: ^(+)(+)@(+)\.(+) But I've recently discovered that addresses with a dash in them won't pass this test. Seems to me they should pass....
3
by: Steven Berkovitz | last post by:
I was just wondering if there is a reason (maybe a RFC requirement?) that the built in email address regular expression for the RegularExpressionValidator in ASP.NET doesn't support email aliases...
3
by: Arpan | last post by:
Consider the following code which validates a TextBox using RegularExpression: <form id="form1" runat="server"> <asp:TextBox id="txt1" runat="server"/> <asp:RegularExpressionValidator...
37
by: Prisoner at War | last post by:
Actually, it doesn't have to be a blockquote...but I'm at my wits' end: I want to make bold several lines of text which have a pair of <br /tags between them...seems like the <b></bdo not "carry...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.