Here is my code:
$str = '<html><p><img src="http://test.com/images.jpg" /><img src="test.com/image2.jpg"><p><html>';
$str_rep = str_replace('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i','http://mywebsite.com/', $str);
I want to replace the image URL using a regular expression. How can I do this?