In the previous article, we implemented the method of string searchVerification of asp email address, it is possible that friends who prefer regular expressions, and the corresponding code is also given here.
Method 1
Copy the codeThe code is as follows:
Public Function ChkMail(ByVal Email)
Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp
= "([.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(.([a-zA-Z0-9]){2,}){1,4}$"
Pmail = (Email) : Set Rep = Nothing
If Not Pmail Then ChkMail = False
End Function
Email address verification 2
Copy the codeThe code is as follows:
<%
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
= "^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"
= True
Set Match = (strng)
if then isemail= true
End Function
%>
Method 3
Copy the codeThe code is as follows:
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
%>
Let's take a look at the use of verification one instance
Copy the codeThe code is as follows:
If ChkMail(admin@) = True Then
"Correct format"
Else
"The format is wrong"
End If