Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Verifier la syntaxe d’un email


{filelink=18790}

using System;
using System.Text.RegularExpressions;
 
namespace AroLibraries.ExtensionMethods.Strings
{
    public static class StringExt
    {
	    // Cette fonction return "true" si l'email est correct
        public static bool EmailEstCorrect(this string s)
        {
            Regex regex = new Regex(@"^[w-.]+@([w-]+.)+[w-]{2,4}$");
            return regex.IsMatch(s);
        }
 
      public static void Main(string [] argv)
       {
 
               Console.WriteLine(Ext_IsValidEmailAddress("demo2005@yahoo.com"));
 
       }
 
    }
 
}

No comments yet.

Leave a Comment