I have many strings (twitter tweets) from which I would like to remove the links when I echo them .
I have no control over the string and even though all the links star
I would do something like this:
$input = "The Third Culture: The Frontline of Global Thinkinghttp://is.gd/qFioda;via @edge";
$replace = '"(https?://.*)(?=;)"';
$output = preg_replace($replace, '', $input);
print_r($output);
It works for multiple occurances too:
$output = preg_replace($replace, '', $input."\n".$input);
print_r($output);