A RegEx to e-mail

Hi,

  What is the pattern tha handles these two e-mail:

  joe@gmail.com
  joe@gmail.com.br

  The patterns that I found don't handle the .br part of the string

  Thanks,

  Marco Castro
MarcoCastroAsked:
Who is Participating?
 
Steve813Commented:
here's another version
^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$

Open in new window

0
 
käµfm³d 👽Commented:
Unless you need something specific, why not just look for "non-whitespace, @ symbol, non-whitespace"?
\S+@\S+

Open in new window

0
 
käµfm³d 👽Commented:
To make it a tad safer, you can exclude extra @'s:
[^\s@]+@[^\s@]+

Open in new window

0
 
Sathish DVSoftware EngineerCommented:
Hope this will be useful....

string EmailPattern = @"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@"
               + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\."
               + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
               + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$";

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.