求一正则表达式
求一正则表达式替换
baidu
如上字符串中标签外的baidu 为baidu
------解决方案--------------------
$s = 'baid,baidu,baidu,google,baidu <a href="http://www.baidu.com"> baidu </a> sdfsdf www.baidu.com ';echo preg_replace("/(?\\1",$s);<br><font color="#e78608">------解决方案--------------------</font><br>$search = array("/(.*)([^\.]baidu[^\.])(.*)/", "/(.*)([^\.]baid[^\.])(.*)/", "/(.*)([^\.]google[^\.])(.*)/");<br>$replace = "\$1<b> baidu </b>$3";<br>$str = '<a href="http://www.baidu.com.com"> baidu baid </a><a href="http://www.baidu.com.com"> 12312 google </a>';<br>$res = preg_replace( $search, $replace, $str );<br>exit($res);<br><br><font color="#e78608">------解决方案--------------------</font><br>貌似PHP里有反向预查,那样的话,很简单的就可以解决了...:D<br>飘走...<div class="clear"> </div>