On Tue, 2007-12-11 at 22:33 -0800, Liz Kim wrote: > I am trying to do a password match with php.. > > It needs to be at least 6 characters, contains 2 alphabets and at least 1 > number or a special character... > > if > (!preg_match("/^.*(?=.{6,})((?=.*\d)|(?=.*[,\=@\"\/'+\*\?\.\[\]\^$\(\){}\|\\&:;'<>~`#%_-]))([a-zA-Z]{2,}).*$/", > $pw1)) {error message} > > is failing to pass "e1w2qw" as a good password although it follows the > instructions... > > I cannot figure out why.. Any reason you took such a complex route? <?php if( strlen( $pw1 ) < 6 || !ereg( '[[:digit:]]', $pw1 ) || strlen( ereg_replace( '[^[:alpha:]]', '', $pw1 ) ) < 2 || strlen( ereg_replace( '[[:alnum:][:space:]]', '', $pw1 ) ) < 1 ) { // error message } ?> Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ........................................................... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php