<form id="form1" runat="server">
<div>
<asp:Label id="lblEmail" Text="Email Address:" AssociatedControlID="txtEmail" Runat="server" />
<asp:TextBox id="txtEmail" Runat="server" />
<asp:RegularExpressionValidator
id="regEmail"
ControlToValidate="txtEmail"
Text="(Invalid email)"
ValidationExpression="\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Runat="server"
/>
<br /><br />
<asp:Button id="btnSubmit" Text="Submit" Runat="server" />
</div>
</form>
There are huge collections of regular expression patterns living on the Internet. My
ReplyDeletefavorite website for finding regular expressions is http://regexlib.com/
regex pattern
ReplyDelete"^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
http://asp.net-informations.com/communications/asp-email-validation.htm
gail
Hi there, checked the code an enhanced version here - https://www.mailcheck.co/
ReplyDeleteCheck their API