<% 'our function to check email addresses 'a fantastic list of regular expressions Function CheckMail(strEmail) 'our variables Dim objRegExp , blnValid 'create a new instance of the RegExp object , note we do not need Server.CreateObject("") Set objRegExp = New RegExp 'this is our pattern we check . objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" 'store the result either true or false in blnValid blnValid = objRegExp.Test(strEmail) If blnValid Then 'display this if it is a vlid email address Response.Write "This is a valid email address
" Else 'display this if it is an invalid email address Response.Write "That email address is invalid
" End If End Function %> <%CheckMail("validmail@email.com") 'correct email address %> <%CheckMail("invalid1") 'incorrect , many errors%> <%CheckMail("invalid+email.com") 'invalid + sign instead of @%> <%CheckMail("invalid@email,com") 'invalid , sneaky uses a comma instead of a full stop%>