ASP E-Mail Validation
<html> <head>
<title>VBscript email validation</title> </head>
<body>
<% Dim
emailAddress emailAddress=Request("emailAddress") if emailAddress <> "" then emailAddress=
Cstr(emailAddress) if emailAddress <> "" then blnValidEmail=RegExpTest(emailAddress) if
blnValidEmail then Response.Write("Valid email address") else Response.Write("Not a valid email
address") end if end if
Function RegExpTest(sEmail) RegExpTest=false Dim regEx,
retVal Set regEx=New RegExp
' Create regular expression: regEx.Pattern
="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"
' Set pattern: regEx.IgnoreCase=
true
' Set case sensitivity. retVal=regEx.Test(sEmail)
' Execute the search test. If not
retVal Then exit function End If
RegExpTest=true End Function Else %>
<form
action="emailCheck.asp" method="post"> <input type="text" name="emailAddress"> <input type="submit"
value="submit"> </form>
<%End If
%>
</body> </html>
|
Article last reviewed: 09/28/2004
|
|
del.icio.us
|
|
Created by: Digital Foundation,
inc.
Copyright © 2002-2005 Digital Foundation,
inc.
www.networkclue.com
|
|
|
All content of the NetworkClue website is copyrighted. Articles, notes,
outlines, and all other materials may not be stored on the Internet or sold or
placed by themselves or with other material in any electronic or printed format in whole or
part. However materials may be referenced by links to the site.
|