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

    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    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?

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

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    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.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    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