Click here to Skip to main content
15,906,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Quote:
/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9\-\_\@\#\$\%\(\)]).{8,}$/


using above.. but it fails on some special character.
accepting special characters are

Quote:
-,_,@,#,$,%,(,)

but its accepting * too...
Posted
Comments
syed shanu 9-May-14 0:31am    
Check this :
((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})
Chk this links for more details :
http://stackoverflow.com/questions/9477906/password-must-be-8-characters-including-1-uppercase-letter-1-special-character

http://stackoverflow.com/questions/19510327/regex-for-alphanumeric-at-least-1-number-and-special-chars

try this

i hope this ill help you.

((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})
 
Share this answer
 
I don't think you can test all of those conditions with a single regular expression. I think the best you can do is test for a match against three regular expressions.
 
Share this answer
 
Comments
Rajni from delhi 9-May-14 6:11am    
ok .. so can u please provide me the regular expression to check just special characters .
allowed characters are @,#,$,%,(,),- and _

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