(?=[@#!$%&+=\-_a-zA-Z0-9]*?[A-Z])
(?=[@#!$%&+=\-_a-zA-Z0-9]*?[a-z])
(?=[@#!$%&+=\-_a-zA-Z0-9]*?[0-9])
[@#!$%&+=\-_a-zA-Z0-9]{8,}
Special chars that are allowed are @#!$%&+=-_
If you want to change the length of the password accepted, (say 12) alter the last term to read {12,}
Unlike IBM I won't try to patent it http://yro.slashdot.org/firehose.pl?id=4629161&op=view. You may use it freely.
Updated per comments by Cadacus ... Thanks!
abcdef12 - passes but doesn't meet criteria
ReplyDeleteAbcde1-2 - fails but meets criteria
found the fix... make sure you quote - in the regex when you don't want to indicate ranges... for example..
ReplyDelete(?=[@#!$%&+=\- <---- used "\" to quote "-"
this fixes the issue with Abcde1-2 and makes your regex a fantastic solution.. thank you so much!
(?=[@#!$%&+=\-_a-zA-Z0-9]*?[A-Z])
ReplyDelete(?=[@#!$%&+=\-_a-zA-Z0-9]*?[a-z])
(?=[@#!$%&+=\-_a-zA-Z0-9]*?[0-9])
(?=[@#!$%&+=\-_a-zA-Z0-9]*?[@#!$%&+=\-_])[@#!$%&+=\-_a-zA-Z0-9]{8,}
ok, tracked it down.. this expression does what you advertise, again thank you so much for posting it.