I have this URLs...
$output = "href=\"/one/two/three\"
href=\"one/two/three\"
src=\"windows.jpg\"
action=\"http://www.google.com/docs\"";
When I apply the regular expression:
$base_url_page = "http://mainserver/";
$output = preg_replace( "/(href|src|action)(\s*)=(\s*)(\"|\')(\/+|\/*)(.*)(\"|\')/ismU", "$1=\"" . $base_url_page . "$6\"", $output );
I get this:
$output = "href=\"http://mainserver/one/two/three\"
href=\"http://mainserver/one/two/three\"
src=\"http://mainserver/windows.jpg\"
action=\"http://mainserver/http://www.google.com/docs\"";
How you can modify the regular expression to prevent this: http://mainserver/http://www.google.com/ ???????