RegularExpressionValidator?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: DC (dc_at_office)
Date: 02/09/04


Date: Sun, 8 Feb 2004 21:43:22 -0500

I have this snippet:

<tr>
 <td align="left">E-mail</td>
 <td>
    <asp:TextBox id="txtEmail" runat="server"
MaxLength="100"></asp:TextBox>&nbsp;
    <asp:RegularExpressionValidator id="revEmail" runat="server"
     ErrorMessage="Enter a valid e-mail address"
ControlToValidate="txtEmail"

ValidationExpression="\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z0-9._%-]{2,4}\b">
    </asp:RegularExpressionValidator>
  </td>
</tr>

My question is why this regular expression is not invoked if I leave the
textbox blank?
My understanding is blank entry is not met the requirement of that regular
expression.

Am I missing something here?

- DC



Relevant Pages

  • Re: RegularExpressionValidator?
    ... > I have this snippet: ... > My question is why this regular expression is not invoked if I leave the ... > textbox blank? ... function properly (if not with a little extra maintenance on your part). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Page.Invalid
    ... The regular expression validator compares the contents of your textbox against a regular expression (regex) If you haven't typed in the regular expression the validator is always going to return true. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: grouping regular expression
    ... I have a form which has a textbox for the user to input the URL and it ... the regular expression has to validate ... I don't understand the clarification. ... .NET 2.0 for Delphi Programmers ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Simple Regular Expression.
    ... Then you escape the slash ... I'm sure once you explain it regular expression will be ... > But please use the docs to get an understanding of how it works. ...
    (comp.lang.perl)
  • How to.. ? in VS.Net 2003
    ... What is the regular expression I should type in "Find what" textbox to find ... the following occurrences? ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)