title: RegularExpressionValidator to limit input length with no limitations on character types
body: <p>I'm trying to use a <code>RegularExpressionValidator</code> to validate a <code>TextBox</code> input length. I have it working, but it only accepts letters and numbers. I'd like to allow <strong>any</strong> characters, with the only check being there are no more than 25 characters. </p>
  
  <pre><code>&lt;asp:TextBox ID="MenuLabel" runat="server" /&gt;
  &lt;asp:RegularExpressionValidator ValidationExpression="^[a-zA-Z0-9]{25}$" ID="MenuLabelVal" runat="server" ErrorMessage="Menu Label must be no longer than 25 characters." ControlToValidate="MenuLabel"  /&gt;
  </code></pre>
  
  <p>Regular expressions are not my strong suit, so can someone tell me how I modify <code>^[a-zA-Z0-9]{25}$</code> to represent <em>any characters</em> up to 25 times rather than just alpha-numeric. </p>
  
  <p><strong>Note 1:</strong> I already have a <code>RequiredFieldValidator</code> in place to ensure 1 or more characters.</p>
  
  <p><strong>Note 2:</strong> I know I could just use the <code>MaxLength</code> property on the TextBox, however this form is also for editing existing data, and I do not want it to simply truncate existing records when editing. I'd prefer to implement a validator which makes it obvious for users editing existing data they need to shorten the value, rather than the form truncating without the user realizing.</p>
  
  <p><strong>Note 3:</strong> I'm open to alternate solutions, such as a custom validator, as long as it relies only on client-side validation. I don't have access to the code-behind to write a custom validate handler on the server.</p>