-2

I want an regex for password which contain following:

  1. It must contain one uppercase letter.

  2. It must contain one lowercase letter.

  3. It also may include symbols but not these:=?<>()'"/\&.

  4. Legth is minimum 8 and maximum 20

Help me please......

Some valid inputs : Abscedsd Ancbdj123 asjkQs23
Some invalid are  : asdfghjk Asdfghj& ashhgWhd=?
anubhava
  • 761,203
  • 64
  • 569
  • 643
Swapnil
  • 11
  • 1
  • 1

3 Answers3

0

Try this: ^.*(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[-_]).*$ or just look around in the forum

Eddynand Fuchs
  • 344
  • 1
  • 13
0

You can use this regex:

^(?=.*?[A-Z])(?=.*?[a-z])(?!.*?[=?<>()'"\/\&]).{8,20}$

Working Online Demo: http://regex101.com/r/lY9iU0

But it will be better in future if you show your own attempts to solve the problem.

anubhava
  • 761,203
  • 64
  • 569
  • 643
0

Have you tried this? - ^(?=.\d)(?=.[a-zA-Z]).{4,8}$

I also found this within this site: ^(?=.[a-z])(?=.[A-Z])(?=.\d)(?=.[$|~=[]'+@.-])[a-zA-Z0-9$|~=[]'+@.-]{8,}$

The entire link is here: Regular expression for password with certain special characters excluding all others

Community
  • 1
  • 1
user2821300
  • 309
  • 1
  • 4
  • 13