try
$matchCount = preg_match_all("/\b([A-Za-z\-_]+:\/\/)?([0-9A-Za-z\-_]+\.)+(com|net|org|edu|mil|gov|biz|\w{2})[\.\?\/#=&0-9A-Za-z\-_]*\b/", $text, $matches);
since you don't want to match just anything with a . in it I tried to be more restrictive by limiting top level domains
$matchCount will be the number of matches found and
$matches[0] will be the array of url's found
this will also find url's like shttp://www.foo.org/file.php?var1=val1&var2=val2