28 Ekim 2013 Pazartesi

c# Blogspot Code Writing

Share:

C# ile geçerli E-Mail adres kontrolü

using System.Text.RegularExpressions;

private const string MatchEmailPattern = 
                  @"^(([\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})#CODE#quot;; 
     
private string mail = hakan@hakanöncel.com


private void button1_Click(object sender, EventArgs e) 
        { 
            bool retVal = false; 
            retVal = Regex.IsMatch(mail, MatchEmailPattern); 
            if (retVal) 
            { 
                MessageBox.Show("OK"); 
            } 
            else 
            { 
                MessageBox.Show("FAIL"); 
            } 
        }
Share:

Blog Arşivi