1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Rep Power

    Question Password checking, 6 or more chars not matched

    I want to make sure that passwords are at least 6 characters in length, one digit, and one special character. Everything else seems to be validated except for the 6 or more characters:

    Regex passreg = new Regex(@"^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[!@#$%^&*+=]).*$");

    Could someone help?

  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    Welcome to DevShed Forums, jevansts.

    Why use a Regex to check the length? It's usually easier to use the normal method for checking the length of a string in whatever language you're using.
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo