Code:
on *:text:*:#:{
set %entry $remove($2-,0,1,2,a,b)
if !%entry { <actions if entry contained only 0's, 1's, 2's, a's and/or b's>
}
}


I think this might be better done using regex, but I'm not familiar enough with regex to give you a code using it, however, the above should work