
May 1st, 2003, 08:16 PM
|
|
Contributing User
|
|
Join Date: Oct 2002
Location: Washington, DC
Posts: 317
Time spent in forums: 2 m 3 sec
Reputation Power: 7
|
|
PHP Code:
function validate_address( $email )
{
if ( preg_match( '/^[A-z0-9\._-]+[@][A-z0-9_-]+([.][A-z0-9\._-]+)+[A-z]{2,4}$/', $email ) )
{
return( ( bool )true );
}
else
{
return( ( bool )false );
}
}
if ( validate_address( 'someone@address.com' ) ) echo( 'good' ); else echo( 'not good' );
EDIT::
VB removes escapes, so use this as the pattern:
'/^[A-z0-9\._-]+[@][A-z0-9_-]+([.][A-z0-9\._-]+)+[A-z]{2,4}$/'
__________________
~ Joe Penn
We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?
Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.
|