Validating an Email Address with a RegularExpressionValidator Control (VB.net) : Email « Validation by Function « ASP.Net






Validating an Email Address with a RegularExpressionValidator Control (VB.net)

<%@ Page Language=VB Debug=true %>
<HTML>
<HEAD>
<TITLE>Validating an Email Address with a RegularExpressionValidator Control</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
Please enter an email address:<BR>
<asp:textbox 
    id="txtEmail" 
    runat=server 
/>
<asp:regularexpressionvalidator 
    id="regEmail"
    controltovalidate="txtEmail"
    validationexpression="\w+\w*\@\w+\w+\w*\.(com|edu|org|gov)"
    display="Dynamic"
    font-name="Arial" 
    font-size="11"
    runat=server
>
    You must enter an email address in the form of me@na.com.
</asp:regularexpressionvalidator>
<BR><BR>
<asp:button 
    id="butOK"
    text="OK"
    type="Submit"
    runat="server"
/>
</form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.asp:RegularExpressionValidator for email address (C#)