validating userid

What's wrong with this syntax? It's part of my 'if' statement but it doesn't seem to pass and it keeps going to the 'else' part.

I thought it says that userid must start with a non-numeric character and is between 6 and 10 characters long (alphanumeric).

$userid|grep -Eq '^[a-zA-Z]?\{6,10\}+$'

if [[ $? -eq 0 ]]; then
..
fi

Also, how do I check that a blank in the first character is also NOT acceptable within the same grep command?? '^[a-zA-Z][^ ]?' didn't seem to do it either.

Gianni

This will also make sure the first character is not a space..

echo $userid | grep -Eq '^[[:alpha:]][[:alnum:]]{5,9}$'
if [[ $? -eq 0 ]]; then
 ..
fi

Also, if this is ksh, you don't need a grep command at all...

if [[ $id = @([A-Za-z])+([A-Za-z0-9]) &&
      ${#id} > 5 && ${#id} < 11 ]] ; then