Server-side ASP/Javascript eMail validation script
This is an invalid eMail address
Enter an eMail adress:
Here is the code:
<html> <head> <title>ASP email validation</title> </head> <body> <script language="javascript" runat="server"> function test(src) { var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/; return regex.test(src); } </script> <% if test(request("xemail"))=true then Response.write("This is a valid eMail address") end if if test(request("xemail"))=false then Response.write("This is an invalid eMail address") end if %> <form action=""> <input type="text" name="xemail"> <input type="submit" name="submit"> </form> </body> </html>