Ver original$str = 'http://www.forosdelweb.com/profile.php?do=buddylist';preg_match('@(www\.|http://)([^\s|/]*)@i', $str, $m);echo $m[0];