On 06/14/2010 08:14 AM, tedd wrote:
> Hi gang:
>
> Considering all the recent parsing, here's another problem to consider
> -- given any text, parse the domain-names out of it.
>
> You may limit the parsing to the most popular TDL's, such as .com, .net,
> and .org, but the finished result should be an array containing all the
> domain-names found in a text file.
>
> Cheers,
>
> tedd
Not extensively tested:
$domains = array();
if(preg_match_all('/[A-Za-z0-9][-A-Za-z0-9\.]*?\.(com|net|org)/i',
$text, $matches)) {
$domains = array_unique($matches[0]);
}
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php