Hi
Code:
echo "ab-c:de:f" | sed -e "s/[^0-9a-zA-Z]//g"
abcdef
The sed removes the "-" and ":" - did you intend it?
Anyway, to remove unwanted characters:
Code:
$safe = ereg_replace('[^0-9a-zA-Z]','',$unsafe);
To check if the length is 6:
Code:
if (strlen($safe) != 6)
die("invalid search");