Click here to Skip to main content
15,031,495 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am not so good in regular expression so I am here for your help.

I have field password which should be minimum 8 character length with atleast one numeric one special character one uppercase one lower case.

This is my regular expression which I have placed in regularexpressionvalidator
^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$

But this will accept only in this format Password@1. But I need to accept in any format with above condition. Please help me to solve this issue
Posted
v2
Comments
♥…ЯҠ…♥ 28-Nov-13 0:59am
   
So your input can also start with special char, number.Characters can be jumbled as user tends to.... am i right?
Mithun P 28-Nov-13 1:00am
   
yes it can be jumbled
♥…ЯҠ…♥ 28-Nov-13 1:05am
   
Okay Mithun, I'll try and update you

Try this

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900