RE: [PHP] Help with Regular Expressions
| From: | John Holmes | Date: | Fri, 27 Sep 2002 00:57:14 +0000 |
| Subject: | RE: [PHP] Help with Regular Expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117799@lists.php.net to get a copy of this message | ||
> I need to filter out certain characters from being
> stored in the database from our signup form. The
> fields include first name, last name, street address,
> city, zip, etc.
> Question 1: What characters should be allowed, other
> than lowercase, uppercase, digits, and the space
> character?
Some names have ' or - in them, same for addresses.
> Question 2: What is a regular expression for this?
Yes...there is a regular expression for everything. :)
Just come up with some functions that filter the input based on a few
regex. You can display it with htmlentities() and it'll stop javascript
and html from being evaluated.
---John Holmes...