note 29764 deleted from function.preg-match by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:16:10 +0000 |
| Subject: | note 29764 deleted from function.preg-match by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57404@lists.php.net to get a copy of this message | ||
Note Submitter: Hervey Allen
----
_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.