RegularExpressionValidator problem

Discussion in 'ASP .Net Web Controls' started by Eric L, Jan 21, 2009.

  1. Eric L

    Eric L Guest

    Trying to use a regex validator control to check password complexity
    requirements in an ASP.NET 1.1 web app. Here is the regex:

    (?=(.*?[a-z].*?){2,})(?=(.*?[A-Z].*?){2,})(?=(.*?\d.*?){2,})(?=(.*?[!#\$%\^&\*@_\|\-=`~\[\]\{\},<>].*?){2,})^.{14,32}$

    The expression uses lookaheads to check for two lowercase, two uppercase,
    two numeric, and two listed special character, and to verify that the length
    of the entire string is between 14 and 32 characters.

    Using the System.Text.RegularExpressions.Regex.IsMatch method reports
    correctly based on the input string, but the ASP.NET validator control always
    reports that any input does not match the regex. Anyone have an idea why?
    Any workarounds to get client side validation to work using the validator
    control? Upgrading is out as this is a legacy .NET 1.1 I'm supporting.
     
    Eric L, Jan 21, 2009
    #1
    1. Advertisements

  2. Eric L

    Paul Shapiro Guest

    Check the documentation, but I seem to remember the regex validator has to
    use a JavaScript-compatible expression or else disable client-side
    validation.
     
    Paul Shapiro, Jan 21, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...