java - how to create regex for password validation -


it @ least 7 characters , 1 of (number or capital case or special character) should there.

requirment is: 1) password must @ least of 7 characters 2) should contain 1 of number or capital case or special character.

for example password can be:

testertest testing6 tester@ok 

i tried not working:

^(?=.*\\d)|(?=.*[a-za-z])|(?=.*[!@#\$%&\*]).{7,20}$ 

you can use:

^(?=.*?[\\da-z!@#$%&*]).{7,20}$ 

online demo: http://regex101.com/r/lc5al2


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -