All those srcs.
-
Help me compile a regular expression (if possible) to make all the src down and add something else to the already existing values. Example:
img src='1'
AFTER
img src='path/1'
-
If it need to be replaced and it's for the tags.
img
, be it:$str = '<body> <img src="photo1.jpg" /> <img class="pic" data-myattr="id100500" src="/PHOTO2.jpg"> </body>'; $result = preg_replace("/(<img[a-z0-9\"'= -]+src=['|\"])\/?([a-z0-9\.\/]+)/i", "$1http://mysite.com/$2", $str); echo $result;
P.S. I'm curious, people are completely depressed? Did you do anything to solve your problem?