Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:25:36+00:00 2026-06-12T22:25:36+00:00

I am having a bit of a hard time with a password requirement regular

  • 0

I am having a bit of a hard time with a password requirement regular expression for an ASP.NET project

Out requirements are the following

  • Must be at least 8 characters
  • Must have at least 3 of the 4 following:
    • Have at least 1 UPPERCASE letter
    • Have at least 1 lowercase letter
    • Have at least 1 special character
    • Have at least 1 number

The regular expression I am using is as follows (this is escaped and encoded for use in the web.config xml file:

passwordStrengthRegularExpression="^.*(?=.{8,})(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()\?\+\,\-\.\/\:\:\;\<\=\>\[\]\\_\`\{\|\}\~\"\']).*$"

I cant figure out how to allow for one of the requirements to be optional.

the password Reaction7 should be sufficient, but it is rejected because it doesn’t have a special character.

Anyone know what I can do to evaluate the 3 out of 4 requirements other than length?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:25:37+00:00Added an answer on June 12, 2026 at 10:25 pm

    Not sure I like this solution, but if you’re limited to using only a single regex (which looks like the case), you could enumerate all possibilities with a pipe-or group:

    passwordStrengthRegularExpression="^.*(?=.{8,})((?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()\?\+\,\-\.\/\:\:\;\<\=\>\[\]\\_\`\{\|\}\~\"\'])|(?=.*[a-z])(?=.*\d)(?=.*[!@#$%^&*()\?\+\,\-\.\/\:\:\;\<\=\>\[\]\\_\`\{\|\}\~\"\'])|(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()\?\+\,\-\.\/\:\:\;\<\=\>\[\]\\_\`\{\|\}\~\"\'])|(?=.*[a-z])(?=.*[A-Z])(?=.*\d)).*$"
    

    It is rather long but does get the job done. Adding a fifth requirement will make this string explode in size though, so it’s not exactly “extendable”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit of a hard time figuring out, how to remove a
I am beginning WPF, and I am having a bit of a hard time
I'm having a hard time figuring out how i can add an arraylist into
I am having a bit of a hard time providing localized strings for the
I am having a bit of a hard time understanding the point in having
I'm having a bit of a hard time. Essentially I need a data structure
I am having a very hard time trying to write out an xml file
I'm having a hard time with current project. In previous versions I used std::vectors
Just having a hard time adding a certain bit of given code to add
I'm a bit of a noob- and I'm having a hard time... I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.