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

    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Need RegEx expression for Strong password


    Hi

    I need RegEx expression for the following:

    Passwords must be at least eight characters including at least one number and one special character (punctuation, symbol or upper/lower case character).

    Note: The RegEx will be used in .NET



    Thanks much!
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,759
    Rep Power
    9397
    1. This forum isn't some regex factory that pumps out regular expressions for anybody who comes back and asks.
    2. Regular expressions aren't the tool for this.
    3. Use String's .Length and .IndexOfAny() instead.
  4. #3
  5. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    I don't know .Net, but I agree that a single RegExp is definitely not the best way to do this.
    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).
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0
    Thanks for your response. However, i am still not able to fullfil the upper/lower (alternate) case requirement. Here is the complete requirement (notice the last clause and example)



    - All passwords must be 8 or more characters in length
    - AND must include at least one numeric (0-9) character
    - AND one punctuation mark OR alternate case (upper/lower) character (for e.g. Bluesky1 or bluEsky1 or green&1&).



    Greatly appreciate your help.sorry if i was not clear earlier about the last clause.
  8. #5
  9. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,759
    Rep Power
    9397
    For the upper-/lowercase condition, check if the lowercase version of a string matches the original string. If so then everything was in lowercase; if not then something was not in lowercase.

IMN logo majestic logo threadwatch logo seochat tools logo