Expression Validator for strings

Results 1 to 2 of 2

Thread: Expression Validator for strings

  1. #1
    Join Date
    Dec 1969

    Default Expression Validator for strings

    I am trying to validate the lenght of a string, but I cannot seem to get it. I am using with I have looked at the example on the site, but it only deals with numbers. This is what I currently have:<BR><BR>&#060;asp:regularexpressionvalidator ControlToValidate="AccountUsername" Display="Dynamic" ErrorMessage="* Invalid Username" ID="CheckUserName" runat="server" Text="* Invalid Username" ValidationExpression="^d{3,15}$" /&#062;<BR><BR>Any ideas would be great.<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default Just replace...

    ...the d (which means "any digit") with . (which means "any character"). Then the {3,15} specifies the min and max number of characters that will match.<BR><BR>Untested, but logical.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts