note 29764 added to function.preg-match

From: Date: Mon, 24 Feb 2003 17:19:32 +0000
Subject: note 29764 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-44440@lists.php.net to get a copy of this message
_Followup to TEXTAREA check_ After playing with this I realized the logic that I really needed is like this: if (((!preg_match("/[A-z0-9_\-\!\@\.]/", $text)) & (preg_match("/(\r|\n|\s\t)/", $text))) or (!preg_match("/[A-z0-9_\-\!\@\.]/", $text))) The "or" clause is necessary if the user has entered invalid text, but no carriage returns, newlines, spaces, or tabs. Once again, the regular expression can be made more compact, but this displays the logic of what we are after. -- http://www.php.net/manual/en/function.preg-match.php http://master.php.net/manage/user-notes.php?action=edit+29764 http://master.php.net/manage/user-notes.php?action=delete+29764 http://master.php.net/manage/user-notes.php?action=reject+29764

« previous php.notes (#44440) next »