simple email validation ereg
| From: | Justin French | Date: | Sun, 02 Jun 2002 04:13:40 +0000 |
| Subject: | simple email validation ereg | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100282@lists.php.net to get a copy of this message | ||
Hi,
I know that there are more complex functions and classes out there for
validating email address', but some of them do return "invalid" on
*technically* valid, although uncommon email address', so all I want is a
simple test for:
(anything)@(anything) followed by 1 or more (.anything)
ie
foo@foo : invalid
foo@foo.foo : valid
foo@foo.foo.foo.foo.foo : valid
i wish to allow ANYTHING really -- not just a-z,A-z,0-9,_,- technically
spaces, brackets, and all sorts of crap are valid in the user portion of the
email address :)
this will return true for foo@blah.com foo@blah.com.au foo@foo.blah.com.au
etc etc... i'm aware that the results will not necessarily BE valid email
address', but at least they'll *look* like valid email address'.
it's for a simple guestbook/message board where some creative people have
put in "lalaland" or "myplace" as an email address, rather than entering
something that at least LOOKS like a valid address, or optionally leaving
the field blank.
my aim will be to strip out anything that doesn't at least LOOK like like an
email address.
regards,
justin french