karunkarthik:i tried my best to include the above check in this regex .. ^(?!.*(.)\1{2})(((?=.*?[a-zA-Z])(?=.*?\d))|((?=.*?[a-zA-Z])(?=.*?[!@#$%^&*()+=._-]))|((?=.*?[!@#$%^&*()+=._-])(?=.*?\d)))([-!@#$%^&*()+=._\da-zA-Z]){8,}$ ... Never worked for me .. Can u please help !!
Thanks
Ok intergrating Sergei's regex with mine the final regex to satisfy all your requirements is
^(?:(?:(?=.*?[a-zA-Z])(?=.*?\d))|(?:(?=.*?[a-zA-Z])(?=.*?[!@#$%^&*()+=._-]))|(?:(?=.*?[!@#$%^&*()+=._-])(?=.*?\d)))(?:([-!@#$%^&*()+=._\da-zA-Z])(?!(.*?\1){2})){8,}$
After this point you are going to have to start helping yourself. You do realize that we are not sitting there next to you watching what you are trying to do, right? How you are implementing and what values you are testing with is something known only to you. You didn't even say which version of Struts you were using. Saying it never worked for you doesn't tell us anything. There is nothing wrong syntax-wise with any regexes you have been provided and while miscommunication may not have provided for all of the specifications in the previous replies that would have worked in every test case, they were certainly more than enough to validate some test cases. All numbers or all as negative test letter for instance. If you are saying that even those cases passed when they should have failed it is not because of the regex, but the way you have failed to implement something needed for this to work. You said before that you didn't know what regex engine you were using, assuming your the only one working on this validation, did you even import the ORO library into your code? Remember we can't see what you are doing. I have not worked with Struts for several years but it was using Jakarta ORO. They last two regexes I've provided you both worked with ORO when tested at http://jakarta.apache.org/oro/demo.html using my own test values. If you are using some other regex library you are going to research and find out what syntax is does and does not support.
My advice, if you haven't already read up on how to implement the validation.xml with Struts, then try a very simple test. Like used the regex ^abc$ to allow only abc to be entered to make sure you code is at least correct. If entering DEF passed then something is not set up correctly. Get that working before trying to used the full password regex.
Michael
"In theory, theory and practice are the same. In practice, they are not."
Albert Einstein