$s = "https://www.collectivesolver.com/ Programming & Software Q&A";
$reg_ex = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
if (preg_match($reg_ex, $s, $url)) {
print_r($url);
echo "yes";
}
else
echo "no";
/*
run:
Array
(
[0] => https://www.collectivesolver.com/
[1] => https
[2] => /
)
yes
*/