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 8038593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:17:05+00:00 2026-06-05T03:17:05+00:00

We have a requirement to make sure password conforms to the specific strength format

  • 0

We have a requirement to make sure password conforms to the specific strength format (this is configured in web.config). Requirements are that password must contain certain number of capital characters and certain number of non-alphanumeric characters. I want to annotate my Password property with regular expression that validates password to make sure password contains x number of CAPS and y number of non-alpha chars. Please help with regular expression.

  • 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-05T03:17:06+00:00Added an answer on June 5, 2026 at 3:17 am

    Checking multiple conditions like this in a single regex is best accomplished using lookaheads, for example say you want 3 capital characters and 4 non-alpha characters, you could use the following regex:

    ^(?=(?:.*[A-Z]){3})(?=(?:.*[^a-zA-Z]){4})
    

    Explanation: first, lets think about what a regex would look like that only checks the first condition. To match 3 uppercase characters we can use the following:

    (?:.*[A-Z]){3}
    

    We can still check this condition by dropping it inside of a lookahead, which is what the (?=...) does, so now (?=(?:.*[A-Z]){3}) checks this condition without consuming any characters. At this point we can check the second condition using (?:.*[^a-zA-Z]){4}. I put this second condition inside of a lookahead as well so that adding more checks is straightforward.

    Note that the current regex won’t actually match any characters, it will match the beginning of the string (zero characters) if all conditions match, otherwise the match will fail. If you want it to actually consume characters as well, just add .* to the end.

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

Sidebar

Related Questions

I have a Requirement to make an IMAP client as a Web application I
I have requirement of specifying web part connections in onet.xml. So when site is
In our project we have requirement that, after receiving sms message from third party
I want to make sure I have the right meta desc/keyword and title text
I have received the unfortunate requirement of building a page that displays a new
Let's say, for the sake of argument, that I have 30 asp.net web applications
I know I'm gonna get down votes, but I have to make sure if
I have a requirement to make the browser URL to Read Only true like
Sure this is a very common requirement, but not able to find any relevant
I have to write a simple key-value store for a very specific use. This

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.