3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "http://www.google.com/\r\nhttp://www.google.com/\r\nhttp://www.google.com/"; echo preg_replace("/(http|ftp)+(s)?:(\/\/)((\w|\.|\-)+)(\/)?(\S)+/","foo",$text); //print_r($matches[0]);

preferences:
34.67 ms | 402 KiB | 5 Q