Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found nice document on MSDN for it.</p> <p>How to: Verify that Strings Are in Valid Email Format <a href="http://msdn.microsoft.com/en-us/library/01escwtf.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/01escwtf.aspx</a> (check out that this code also supports the use of non-ASCII characters for Internet domain names.)</p> <p><strong>There are 2 implementation, for .Net 2.0/3.0 and for .Net 3.5 and higher.<br> the 2.0/3.0 version is:</strong></p> <pre><code>bool IsValidEmail(string strIn) { // Return true if strIn is in valid e-mail format. return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"); } </code></pre> <p><strong>My tests over this method give:</strong></p> <pre><code>Invalid: @majjf.com Invalid: A@b@c@example.com Invalid: Abc.example.com Valid: j..s@proseware.com Valid: j.@server1.proseware.com Invalid: js*@proseware.com Invalid: js@proseware..com Valid: ma...ma@jjf.co Valid: ma.@jjf.com Invalid: ma@@jjf.com Invalid: ma@jjf. Invalid: ma@jjf..com Invalid: ma@jjf.c Invalid: ma_@jjf Invalid: ma_@jjf. Valid: ma_@jjf.com Invalid: ------- Valid: 12@hostname.com Valid: d.j@server1.proseware.com Valid: david.jones@proseware.com Valid: j.s@server1.proseware.com Invalid: j@proseware.com9 Valid: j_9@[129.126.118.1] Valid: jones@ms1.proseware.com Invalid: js#internal@proseware.com Invalid: js@proseware.com9 Invalid: js@proseware.com9 Valid: m.a@hostname.co Valid: m_a1a@hostname.com Valid: ma.h.saraf.onemore@hostname.com.edu Valid: ma@hostname.com Invalid: ma@hostname.comcom Invalid: MA@hostname.coMCom Valid: ma12@hostname.com Valid: ma-a.aa@hostname.com.edu Valid: ma-a@hostname.com Valid: ma-a@hostname.com.edu Valid: ma-a@1hostname.com Valid: ma.a@1hostname.com Valid: ma@1hostname.com </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload