Re: Mailing address validation... too many possibilities?
| From: | Max Derkachev | Date: | Thu, 23 Nov 2000 15:24:20 +0000 |
| Subject: | Re: Mailing address validation... too many possibilities? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26837@lists.php.net to get a copy of this message | ||
Dallas Kropka wrote:
> I need to validate that a mailing address does not contain invalid characters... no
> <script> or PHP code for security,.... that sort of thing. Instead of validating the format of
> the entry, I think it would be easier to check for cretin invalid characters..... how would I do
> this?
use regexp. I.e. from Manuel Lemos' email validation class (excellent for any of email
validation tasks, take it at http://phpclasses.upperdesign.com).
$regexp = "^([-!#\$%&'*+./0-9=?A-Z^_
a-z{|}~
])+@([-!#\$%&'*+/0-9=?A-Z^_a-z{|}~ ]+\\.)+[a-zA-Z]{2,4}\$";
if (eregi ($regexp, $email ) ) echo "$email is valid";
else echo "don't fool me, buddy";
--
Best regards,
Max A. Derkachev mailto:kot@books.ru
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia