还有,
如果使用小写字母查询
用这个函数会把原本的大写字母替换成小写,不知道如何保持原来的写法(大写或小写)
我看到GOOGLE是这样的

解决方案 »

  1.   

    <?
    $str='din 1693(Pt.2)-1997';
    echo preg_replace("/(".preg_quote($str).")/","<strong>\\1</strong>",$str);
    ?>
      

  2.   

    转义
    quotemeta
    preg_quote如果是ereg函数组用quotemeta
    如果是preg函数组用preg_quote
      

  3.   

    echo preg_replace("/(".preg_quote($str).")/","<strong>\\1</strong>",$str);
    \\1就是引用找到的部份,这样可保留原来大小写.