?
Solved

Regex - email

Posted on 2013-11-15
8
Medium Priority
?
4,249 Views
Last Modified: 2013-11-18
This is the email pattern I use to valid email address format.  I just want to add "`"  to this pattern. Sample john'ona.doe@mysite.com This is a good format.
^([\w\d\-\.]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 39652176
fred&barney@stonehenge.com
is a valid email address that is not recognized by the above pattern
0
 

Author Comment

by:VBdotnet2005
ID: 39652219
If that is the case, could you add that also?
0
 
LVL 19

Expert Comment

by:bevhost
ID: 39652317
^([\w\d\-\.\`\&]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$
0
Independent Software Vendors: 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!

 
LVL 14

Expert Comment

by:sentner
ID: 39652344
To add characters to the name portion, just add them inside the first set of square brackets. There are a bunch of possible characters missing from the pattern above (including: ! # $ % & ' * + - / = ?  ^ _ ` . { | } ~), please see:

http://tools.ietf.org/html/rfc3696

That said, your expression does include some unnecessary redundancies (like "\w\d" which can be simplified to just \w).   You may need to escape out some of the special characters (possibly including `) but not all of them.
0
 
LVL 19

Assisted Solution

by:bevhost
bevhost earned 500 total points
ID: 39652362
You're still a long way from accepting all valid email addresses.
see
http://en.wikipedia.org/wiki/Email_address
Also I think ' is probably more common than `
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 500 total points
ID: 39652363
You might want to read the information presented at this link:

http://www.regular-expressions.info/email.html

...pertaining to why overly-complicated email patterns aren't usually necessary.
0
 
LVL 14

Accepted Solution

by:
sentner earned 500 total points
ID: 39652393
This should catch all of the possible characters:

^([\w!#$%&\'\*+-/=\?^\`\.\{\|\}~]+)\@{1}(([\w-]{1,67})|([\w-]+\.[\w-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$
0
 
LVL 11

Assisted Solution

by:SAMIR BHOGAYTA
SAMIR BHOGAYTA earned 500 total points
ID: 39655778
hi.. You just use this...

private static Regex emailRegex = new Regex(@"^([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})(\]?)$")
0

Featured Post

Independent Software Vendors: 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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

764 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