欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp email郵箱地址驗(yàn)證正則表達(dá)式

 更新時(shí)間:2010年05月27日 11:52:15   作者:  
剛才說了郵箱驗(yàn)證先可用js來處理,然后再由asp,php來做,下面我來看看一個(gè)asp 郵箱地址驗(yàn)證正則表達(dá)式全新實(shí)例吧。

上篇文章我們用字符串查找的方法實(shí)現(xiàn)了asp email郵箱地址的驗(yàn)證,有可能比較喜歡正則表達(dá)式的朋友,這里也給出相應(yīng)的代碼。
方法一

復(fù)制代碼 代碼如下:

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

郵箱地址驗(yàn)證二
復(fù)制代碼 代碼如下:

<%
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
%>

方法三
復(fù)制代碼 代碼如下:

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
%>

我們來看看驗(yàn)證一的實(shí)例使用方法
復(fù)制代碼 代碼如下:

If ChkMail(admin@jb51.net) = True Then
Response.Write "格式正確"
Else
Response.Write "格式有誤"
End If

相關(guān)文章

最新評(píng)論