<?php
$tmp = "test1='x' and test3='97' and test3='99'";
$str = "abcd"; // 替换成的内容
$tmp = preg_replace("/(test3=)(\')(.*)\\2/U", "\\1\\2$str\\2", $tmp);
echo $tmp;
?>
$tmp = "test1='x' and test3='97' and test3='99'";
$str = "abcd"; // 替换成的内容
$tmp = preg_replace("/(test3=)(\')(.*)\\2/U", "\\1\\2$str\\2", $tmp);
echo $tmp;
?>
// 也许这样更好一些$tmp = "test1='x' and test3='97' and test3=\"99\" and TEST3=\"ff\"";
$str = "abcd"; // 替换成的内容
$tmp = preg_replace("/(test3=)([\'\"])(.*)\\2/iU", "\\1\\2$str\\2", $tmp);
echo $tmp;
?>