[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Regex Password Validation

Posted on 2009-12-18
Medium Priority
Last Modified: 2012-05-08
Can someone provide me with a regex string that I can use in C# for password validation?  The requirements are as follows:

Character length: 7-30.
Must contain at least one number.
Must contain at least one symbol/special character.
Remaining characters can contain any combination of upper/lower case letters, numbers and symbols.

Question by:mdtanner

Accepted Solution

maheshsnkr earned 500 total points
ID: 26085883

Try the following regex


This will check the follwoing conditions

Character length: 7 (won't check the max length as 30 - put the maxlength of the textbox to 30)
Must contain at least one number.
Must contain at least one symbol/special character- (])(?=.*[@#$%^&+=] are the included special characters)

LVL 20

Expert Comment

ID: 26085891

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question