四种asp 电子邮箱验证函数

Public Function IsEmail(ByVal PString)
Dim Plt,Pgt : Plt = False : Pgt = False
For x = 2 To Len(PString) - 1
If Mid(PString,x,1) = "@" Then Plt = True
If Mid(PString,x,1) = "." And Plt = True Then Pgt = True
Next
If Plt = True And Pgt = True Then
IsEmail = True
Else
IsEmail = False
End if
End Function
%>

'********************************************
'函数名:IsValidEmail
'作 用:检查Email地址合法性
'参 数:email ----要检查的Email地址
'返回值:True ----Email地址合法
' False ----Email地址不合法
'********************************************

Public Function IsValidEmail(Email)
Dim names, name, I, c
IsValidEmail = True
names = Split(Email, "@")
If UBound(names) <> 1 Then IsValidEmail = False: Exit Function
For Each name In names
If Len(name) <= 0 Then IsValidEmail = False:Exit Function
For I = 1 To Len(name)
c = LCase(Mid(name, I, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then IsValidEmail = False:Exit Function
Next
If Left(name, 1) = "." Or Right(name, 1) = "." Then IsValidEmail = False:Exit Function
Next
If InStr(names(1), ".") <= 0 Then IsValidEmail = False:Exit Function
I = Len(names(1)) - InStrRev(names(1), ".")
If I <> 2 And I <> 3 Then IsValidEmail = False:Exit Function
If InStr(Email, "..") > 0 Then IsValidEmail = False
End Function

 

<%
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern = "^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>

 

Public Function ChkMail(ByVal Email)
Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp
Rep.Pattern = "([.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(.([a-zA-Z0-9]){2,}){1,4}$"
Pmail = Rep.Test(Email) : Set Rep = Nothing
If Not Pmail Then ChkMail = False
End Function

时间: 2024-09-20 00:07:23

四种asp 电子邮箱验证函数的相关文章

电子邮箱验证函数

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.111cn.net/1999/xhtml"> <head> <meta http-equiv="conte

JavaScript验证电子邮箱的函数_javascript技巧

本文介绍一个JavaScript验证电子邮箱的函数,相当靠谱. JavaScript验证电子邮箱的函数,源代码如下: function checkEmail(text) { if( text.match(/qq\.com$/) ) { return -1; } if( ! text.match(/^\w+([._-]\w+)*@(\w+\.)+\w+$/) ) { return false; } return true; } 关于JavaScript验证电子邮箱的函数,本文就介绍这么多,希望对您

asp 电子邮箱email验证实例程序

 电子邮箱email验证实例程序 function IsValidEmail(email) dim names, name, i, c 'Check for valid syntax in an email address. IsValidEmail = true names = Split(email, "@") if UBound(names) <> 1 then    IsValidEmail = false    exit function end if for e

分享四种asp.net读取xml文档的代码(1/2)

方法一 :使用XML控件  代码如下 复制代码 <%   @ Page Language="C#"%>   <html>   <body>   <h3><font face="Verdana">读取XML方法一</font></h3>   <from runat=server>   <asp:Xml id="xml1" DocumentSourc

获得内核函数地址的四种方法

获得内核函数地址的四种方法   本文以获取内核函数 sys_open()的地址为例.   1)从System.map文件中直接得到地址:      $ grep sys_open /usr/src/linux/System.map      2)使用 nm 命令:      $ nm vmlinuz | grep sys_open      3)从 /proc/kallsyms 文件获得地址:      $ cat /proc/kallsyms | grep sys_open      4)使用

app软件中需要使用到邮箱验证,具体怎么实现,开发语言是java?

问题描述 app软件中需要使用到邮箱验证,具体怎么实现,开发语言是java? 有没有那还种第三方的邮箱验证的资源,就像CSDN注册的那样,在邮箱中点击邮件内的链接完成注册? 解决方案 这个需要server支持吧?从server端发邮件和验证注册.你是想直接用别人提供的这些服务? 解决方案二: 本人做过这个给你点建议: 这个得考虑到你的邮件数据量的问题,如果每天只发个100封邮件的话,很好实现.网上例子多的很. 原因是一般的什么163的邮箱都有个发送限制.超过了.他就封了你. 如果超过这个上限的话

asp邮箱email地址正则表达式验证函数

函数名:chk_Email() '返回值:布尔值(True为通过,False为未通过) '参数:email(需要判断的email,类型:字符串)   Type_1(是否需要判断@之后的domain,类型:布尔值) 'Type_2(是否只能是特定域的E-Mail注册,类型:布尔值) Type_3(一个E-Mail是否只能注册一次,类型:布尔值) Const C_maildomain=".com,.com.cn,.net,.net.cn,.org,.org.cn,.gov,.gov.cn,.edu,

ASP.NET MVC下的四种验证编程方式[续篇]

原文:ASP.NET MVC下的四种验证编程方式[续篇] 在<ASP.NET MVC下的四种验证编程方式>一文中我们介绍了ASP.NET MVC支持的四种服务端验证的编程方式("手工验证"."标注ValidationAttribute特性"."让数据类型实现IValidatableObject或者IDataErrorInfo"),那么在ASP.NET MVC框架内部是如何提供针对这四种不同编程方式的支持的呢?接下来我们就来聊聊这背后的

ASP.NET MVC下的四种验证编程方式[续篇]_实用技巧

在<ASP.NET MVC的四种验证编程方式>一文中我们介绍了ASP.NET MVC支持的四种服务端验证的编程方式("手工验证"."标注ValidationAttribute特性"."让数据类型实现IValidatableObject或者IDataErrorInfo"),那么在ASP.NET MVC框架内部是如何提供针对这四种不同编程方式的支持的呢?接下来我们就来聊聊这背后的故事. 一.ModelValidator与ModelVali