I have a string taken from a form and I need to verify that it contains at least 1 number, 1 upppercase letter, and 1 lowercase letter.
Any ideas?
So in other words you want to make sure it matches "[0-9]", matches "[A-Z]" and matches "[a-z]"?
yea, basically. so would I write that as:
$str = "ewTY5"; if(!ereg("^[a-z][A-Z][0-9]", $str)) echo "Not Cool"; else echo "Cool"; // should echo Cool
No, they're three separate matches (your pattern won't match 'ewTY5' or '5aB', for example).