I want string consisting of 4 digits and check string with this code: if (preg_match("/\d{4}/",$_POST[id])) { echo $_POST[id]; } but preg_match returns true when string consists of 4 or more digits -- - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php