PHP正则问题
有两个链接,想将其中一个转换成另一个
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 比如: 链接A : http://user.qzone.qq.com/[color=#FF0000]1340477530[/color]#!app=2&pos=[color=#FF0000]1300412602[/color] 链接B :http://b.qzone.qq.com/cgi-bin/blognew/blog_output_data?uin=[color=#FF0000]xxxxx[/color]&blogid=[color=#FF0000]yyyyyyy[/color]&numperpage=1000&property=GoRE
$str1 = "http://user.qzone.qq.com/1340477530#!app=2&pos=1300412602"; $str2 = "http://b.qzone.qq.com/cgi-bin/blognew/blog_output_data?uin=1111&blogid=2222&numperpage=1000&"; preg_match('/([\d]+).*pos=([\d]+)$/', $str1, $match); if (isset($match[1]) && isset($match[2])) { $pa=array('/uin=[\d]+/','/blogid=[\d]+/'); $re=array('uin='.$match[1],'blogid='.$match[2]); $str2=preg_replace($pa,$re,$str2); echo $str2; } <div class="clear"> </div>