Part 1ArticleWe use the string SEARCH method to verify the ASP email address. It may be a friend who prefers regular expressions.Code.
Method 1
Copy code The Code is as follows: public function chkmail (byval email)
Dim rep, pmail: chkmail = true: Set rep = new Regexp
Rep. pattern = "([. a-zA-Z0-9 _-]) {} @ ([a-zA-Z0-9 }(. ([a-zA-Z0-9]) {2,}) {} $"
Pmail = rep. Test (email): Set rep = nothing
If not pmail then chkmail = false
End Function
Email address verification 2 Copy codeThe Code is as follows: <%
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
%>
Method 3 Copy 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 how to verify the use of instance 1. copy Code the code is as follows: if chkmail (admin@jb51.net) = true then
response. write "The format is correct"
else
response. write "Incorrect format"
end if