im trying to write a regular expression that makes sure that a person registering on my site can only have a username that contains characters of numbers
function checkUsername ($username) {
if(preg_match("/^[0-1A-Za-z]{6,10}/" , $username)){
return true; }
return false; }
then later to call the function
$username = trim($_POST['username']);
if(!checkUsername($username)) {
$errors['username'] = "please enter a valid username";
}
i just cant get my head round them!!!