如何使用一个斜杠修改http标签以双斜杠

I have a list of links and some of them contains a http:/ instead of http:// but i can't search for http:/ because http:// could also exists and replacing one / to multiple could alter the path...

So can someone tell me how i can change (ftp|http(s)):/ to (ftp:http(s))://

Replace http:// by http:/ and then replace http:/ with http:// ;) that's a quick and dirty fix but it works.

This should work (without a double replace):

<?
echo preg_replace("#(http|ftp|https):/([^/])#", "$1://$2", 'http://www.google.com');
echo "<br>";
echo preg_replace("#(http|ftp|https):/([^/])#", "$1://$2", 'http:/www.google.com');
?>

This will only do the replace if there is no double slash.