Hello, I dont know that much aboput regular expressions and just want to know how to find out the number of special (non alphanumeric) characters in a string or how to match a string that contains less than 3 special chars. urrently im using a function function valid_username($string) { if(strlen($string)<=16&&strlen($string)>5) { return(preg_match('/^[ -~äöüßÄÖÜ]+$/',$string)); } else { return FALSE; } } This allows usernames of 6 to 16 length containing many special chars and German "Umlaute". But this also allows usernames like "=)/(&%$" what should not be. So how to limit the number of special chars? This function should just return fals if number of special chars > X Greets, Holger Sunke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php