?
Solved

ASP .NET Email Address validation more than one period in address

Posted on 2011-05-09
2
Medium Priority
?
562 Views
Last Modified: 2012-06-21
Hi,
I am trying to correct and email address validation to accept more than one period in the address as per the following example:

john.e.smith@smith.com

I am using the following validation string:

"^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9_]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$

Does anyone have a clue to to adapt this to make it happen!
Cheers,
Iain H
0
Comment
Question by:RBG IT
2 Comments
 
LVL 15

Accepted Solution

by:
Thogek earned 2000 total points
ID: 35725104
Haven't fully tested this (disclaimer), but have you tried something like

^[a-zA-Z0-9][-\._a-zA-Z0-9]*@[a-zA-Z0-9][-\._a-zA-Z0-9]*\.[a-zA-Z]{2,4}$

Open in new window


There're also some interesting (if more involved) discussions (and warnings) at:
http://www.regular-expressions.info/email.html
http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
http://www.codeproject.com/KB/recipes/EmailRegexValidator.aspx
http://support.microsoft.com/kb/308252
etc.
0
 

Author Closing Comment

by:RBG IT
ID: 35726629
Many thanks did the trick
Cheers,
Iain
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question