Please UseCodeTags when posting code. It will highlight your code and make it much easier to read. It probably will also increase the number of people helping you. Also use proper indentation. This is hard to read. You can edit your post with the button.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
1) You haven't included '&' in your set of 'special' characters!
2) You need to use matches() and not find() or the length check term will pass for lengths greater than 7.
P.S. What business case can be made for limiting a password to less than 8 characters? Seems daft to me as presumably one is only storing a seeded digest and not the full password and it reduces significantly the entropy of the allowable passwords.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Joined: Sep 15, 2010
Thanks for adding code tag. I was about to do that.
thanks for your comment. I forgot to add "&" character in the set. after adding it is working fine.