Hi As I said before I don't use posix regexes (i.e. ereg), as they're not binary safe and can be much slower than the PCRE versions. the PCRE equivalent of what you want is: if (preg_match("/^[-A-Za-z0-9_' ]+$/", $string)}: echo "string valid"; else: echo "string invalid"; endif; The "A-Za-z0-9_" can be simplified to "\w" meaning any 'word' character. The slashes '/' are required as delimeters around a regex with PCRE. The '^' and '$' anchor to beginning and end. This makes sure you're testing the whole string not just a part of it, otherwise it would match up to the first invalid character but still make a match. I use this kind of test frequently myself, so I know it is possible and fairly simple to do. Niel -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php