RE: [PHP] regex (preg_match) tld question

From: Date: Mon, 16 Oct 2000 06:11:14 +0000
Subject: RE: [PHP] regex (preg_match) tld question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-20304@lists.php.net to get a copy of this message
> > if (!preg_match('/^[_\.\'0-9a-z-]+@(\w+\.)+( ALL TLDS )$/',$value)) > > Three options off the top of my head: > > Place all TLD's in a string "com|org|net|us|ca|uk...etc..." This is highly inefficient with a regex, better use one of the options below. > Have TLD's in a db, which you do a lookup against in the next line Better... > Have TLD's in an array, which you do an inarray() against in the next line Best, because you could even have this cached on a file... serialization... Cheers, Matthias aka Matthew

« previous php.general (#20304) next »