天天看点

C#中手机号验证,邮箱验证

手机号码

    public bool IsHandset(string str_handset)

    {

            return System.Text.RegularExpressions.Regex.IsMatch(str_handset, @"^[1]+[3,5]+\d{9}$");

    }

 验证 E-mail格式

   public bool IsEmail(string str_Email)

   {

            return System.Text.RegularExpressions.Regex.IsMatch(str_Email,

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

   }