$re = '/(?:\S)(https?:[\S]*)(?:&ct=ga&cd=)/';
$str = 'https://www.google.com/url?rct=j&sa=t&url=http://4pda.ru/forum/index.php?showtopic=701750&st=7440&ct=ga&cd=CAEYACoUMTQzMjUxOTE3ODExNDA5NDA0ODcyHGU3M2YyMjY3MmQ0NTY5MzU6cnU6ZW46UlU6Ukw&usg=AFQjCNGp1zcChJ_QT82U_lt_rWOuIkasBg';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php