Hello
I have a validation script to check that a proper e.mail address has been added to a form, but can't seem to get it to work.
Here's the code and I would be grateful for any suggestions.
Cheers
LaPluma
<%
Dim emailAddress
emailAddress = Request("Email"
if emailAddress <> "" then
emailAddress = Cstr(Email)
if emailAddress <> "" then
blnValidEmail = RegExpTest(Email)
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
%>
<%End If %>
I have a validation script to check that a proper e.mail address has been added to a form, but can't seem to get it to work.
Here's the code and I would be grateful for any suggestions.
Cheers
LaPluma
<%
Dim emailAddress
emailAddress = Request("Email"
if emailAddress <> "" then
emailAddress = Cstr(Email)
if emailAddress <> "" then
blnValidEmail = RegExpTest(Email)
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
%>
<%End If %>