/* 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 the width attribute
preg_match('/
echo $match[1];
//3. Get the height attribute
preg_match('/
echo $match[1];
//4. Get src
preg_match('/
echo $match[1];
//1. Replace src="/uploads/images/20100516000.jpg" with 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);
?>