Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need Help with Password RegEx

Posted on 2013-11-20
2
Medium Priority
?
472 Views
Last Modified: 2013-11-20
Need help with a password RegEx I'd like to use. I've been up on the sites, but I'm not that familiar with RegEx and would appreciate some help.

Note I'm using .NET 4.0 and C#, but I'd like it to work in JavaScript as well if possible.

Password Requirements:
====================

1. Must be at least six characters long.
2. Must contain at least two numbers.
3. Must have at least one upper case character.
4. Must have at least one lower case character.
5. Must have at least one of the following special characters: !@#$%*.\+

My main problem is I can't seem to match regardless of placement. RegEx patterns are good with things like, a phone number: They have a placement you match against. You do three digits, then three digits, then four digits.

Email addresses have a string with letters and number, then an @ sign, and then more letters and numbers and a dot and a domain.

We have order here. My password doesn't have necessary order. I can do "P@SSword123" or "PA$$W04d" or "paSS30r*" and note that the special character and be at any location.

I was thinking nested square brackets like this [[\w][\d][etc]] would work, but it doesn't.

I'd appreciate any help on this. Thanks.
0
Comment
Question by:Daniel Van Der Werken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 39662882
(?=.{6})(?=.*\d.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%*.\\+])
0
 
LVL 20

Author Comment

by:Daniel Van Der Werken
ID: 39663037
I don't think, from what I've read, that (?= works for JavaScript. Does it? If not, do you have a JavaScript equivalent?
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

688 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