Re: Another parse problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux