'Username can only contain US-ASCII alphanumeric characters, plus any of the symbols $-_.+!*\'(), and "' ); public function isValid($value, $context = null) { $this->_setValue($value); if (preg_match('/^[A-Za-z\$-_.\+!\*\'\(\)",]+$/', $value)) { return true; } else { $this->_error(self::BAD); return false; } } }