Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web, Visual Basic
Expertise: Intermediate
Aug 19, 2002

Validate an Email Address


Below is a VB Script example of how to validate an email address using Regular Expressions:
 
<script language="vbscript">
function ValidateEmail(sEmail)
    set myExpression = new RegExp
    myExpression.pattern = "^(\w+\.)*(\w+)@(\w+\.)+([a-zA-Z]{2,4})$"
    If myExpression.test(sEmail.value) = True Then
	msgbox "Valid Email"
    Else
	msgbox "Invalid Email"
    End If
End Function
</script>

<form name="email">
<input type=text name="txtEmail" maxlength=44 width=40>
<input type=button onclick="ValidateEmail(txtEmail)">
</form>
Jill Herrmann
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date