zoukankan      html  css  js  c++  java
  • 写的一个判断注册Email是否是个人邮件,而不是公司邮件的方法

    以下这个方法其实也不是很全面,它只判断了hotmail, gmail和yahoo

    如果你还需要加上其他认为是私人Email的Email, 只要按照同样的方法自己加上就可以了

        Public void CheckPersonalEmail(ByVal sender As Object, ByVal email As ServerValidateEventArgs)
        {
                string strEmail = email.Value.ToLower;
              
                var r = New Regex("([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$", RegexOptions.IgnoreCase);
                
                if((strEmail <> "") And (strEmail.IndexOf("hotmail") = -1) And (strEmail.IndexOf("gmail") = -1) And (strEmail.IndexOf("yahoo") = -1) And (r.Match(strEmail).Success))
                 email.IsValid = true
                
                if  (!email.IsValid) 
                {
                    If (strEmail = "") 
                          CustomValidator1.ErrorMessage = "<br />Please enter an email address"
      
                    If ((strEmail.IndexOf("hotmail") > -1) Or (strEmail.IndexOf("yahoo") > -1) Or (strEmail.IndexOf("gmail") > -1)) 
                        CustomValidator1.ErrorMessage = "<br />You cannot use a personal email address"
    
                   
                    If  (!r.Match(strEmail).Success) 
                         CustomValidator1.ErrorMessage = "<br />You must enter a valid email address"
                }
    
         }
        

    基于vb.net我自己改写的,可能有的地方语法不正确,自己在Visual Studio中更改就好

  • 相关阅读:
    [调参]batch_size的选择
    [调参]CV炼丹技巧/经验
    [Pytorch]Pytorch加载预训练模型(转)
    [PyTorch]论文pytorch复现中遇到的BUG
    [Opencv]图像的梯度与边缘检测(转)
    freemodbus移植、实例及其测试方法
    eclipse的C/C++开发搭建
    ROS安装
    U-boot移植
    QT开发实战一:图片显示
  • 原文地址:https://www.cnblogs.com/wphl-27/p/5900039.html
Copyright © 2011-2022 走看看