/*PHP regular extraction of any attributes in the image img tag*/
$str = '
//1. Get the entire image code
preg_match('/]*?srcs*=s*('|")(.*? )\1[^>]*?/?s*>/i',$str,$match);
echo $match[0];
//2. Get width
preg_match('/
echo $match[1];
//3. Get height
preg_match('/
echo $match[1];
//4. Get src
preg_match('/
echo $match[1];
/*PHP regular replacement of any attribute in the image img tag*/
//1. Replace src="/uploads/images/20100516000.jpg" for src="/uploads/uc/images/20100516000.jpg")
print preg_replace('/(
echo "
";
//2. Replace src="/uploads/images/20100516000.jpg" with src="/uploads/uc/images/20100516000.jpg", and omit the width and height
print preg_replace(' /(/i',"${1} $ {2}uc/images/${3}>",$str);
?>