Hi, I've been trying to write a regular expression that checks to make sure a string contains only numbers and letters, no other characters, if someone has one of these already written could you please post an example i could use?
Thank you,
how about...
echo preg_match('/^[0-9a-z]*$/i', $myString) ? 'true' : 'false';
Or...
if(ereg("^[:alnum:]+$",$string)) { echo "yep"; } or if(ereg("^[0-9A-Za-z]+$",$string)) { echo "yep"; } or if(eregi("^[0-9a-z]+$",$string)) { echo "yep"; }