c# проверка email

public static bool checkEmailString(string val)
        {
            if (val.Trim() != "")
            {
                System.Text.RegularExpressions.Match rex = 
                    System.Text.RegularExpressions.Regex.Match(val.Trim(),
                    "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,3})$", 
                    System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!rex.Success)
                    return false;
                else
                    return true;
            }
            else
                return false;
        }

No comments:

Post a Comment