'Username can only contain US-ASCII alphanumeric characters, plus any of the symbols $-_.+!*\'(), and "', self::BAD2 => 'Username is invalid' ); public function isValid($value, $context = null) { $this->_setValue($value); if (!preg_match('/^[A-Za-z\$-_.\+!\*\'\(\)",]+$/', $value)) { $this->_error(self::BAD); return false; } $config = Zend_Registry::get('config'); foreach ($config->security->usernames->exclude as $regex) { if (!$regex) { continue; } $regex = preg_quote($regex); if (preg_match("/$regex/", $value)) { $this->_error(self::BAD2); return false; } } return true; } }