警告:preg_replace():编译失败:在偏移量 5 处没有重复的内容


Warning: preg_replace(): Compilation failed: nothing to repeat at offset 5

正如我在标题中提到的,我收到*警告:preg_replace():编译失败:*这对我来说真的很奇怪;

实际上在 godaddy 的 VPS 上,我移动了我的网站; 首先我得到了 GD 库的错误; 所以我使用 WHM 的简单 apache 安装了 GD 库,然后现在当我尝试运行我的网站时,我收到此警告,Warning: preg_replace(): Compilation failed: nothing to repeat at offset 5在此页面上 techchef.org/development/module/newsfeed/LoadDataFromFeed.php

但是相同的脚本在我的另一台 techchef.org/development/module/newsfeed/LoadDataFromFeed.php 服务器上运行并且工作正常

这是我不确定是否是因为 Apache 设置的脚本,如果是,那么我实际上错过了什么。

下面是它提到错误的 php 脚本

$str= strtolower($str);
      $str= preg_replace("/(à|á|?|?|ã|â|?|?|?|?|?|a|?|?|?|?|?)/","a",$str);  
      $str= preg_replace("/(è|é|?|?|?|ê|??|?|?|?|?)/","e",$str);  
      $str= preg_replace("/(ì|í|?|?|i)/","i",$str);  
      $str= preg_replace("/(ò|ó|??|??|õ|ô|?|?|?|?|?|o|??|?|?|?|?)/","o",$str);  
      $str= preg_replace("/(ù|ú|?|?|u|u|?|?|?|?|?)/","u",$str);  
      $str= preg_replace("/(?|ý|?|?|?)/","y",$str);  
      $str= preg_replace("/(d)/","d",$str);  
      $str= preg_replace("/(!|@|%|'^|'*|'(|')|'+|'=|'<|'>|'?|'/|,|'.|':|';|''| |'"|'&|'#|'[|']|~|$|_)/","-",$str); 
      $str= preg_replace("/(-+-)/","-",$str); 
      $str= preg_replace("/(^'-+|'-+$)/","",$str); 
      $str= preg_replace("/(-)/"," ",$str); 

当您从任何修改格式/编码的地方复制代码时。

$str= preg_replace("/(à|á|?|?|ã|â|?|?|?|?|?|a|?|?|?|?|?)/","a",$str);
                       // ^- offset 5

有根据的猜测,这个[以及所有其他问号]应该是另一个类似a字符,而不是问号。 ? 是与重复 [0 或 1] 有关的元字符,应转义为文字?

其他表达式也是如此。