Php 拉丁字符集的preg_匹配

Php 拉丁字符集的preg_匹配,php,regex,preg-match,Php,Regex,Preg Match,我如何修改这些代码以使我的搜索也匹配5个字符?(当我查询以“ç”开头的单词时,我希望得到所有以字母“ç”或“ç”或“c”或“c”开头的单词) 另一个代码: preg_match("/".$pattern."/i", remove_accents($word))) || ($common[$word] == 1) foreach($words['hilight'] as $change) { while (preg_match("~[^\>](".$change.")[^\<]~i",

我如何修改这些代码以使我的搜索也匹配5个字符?(当我查询以“ç”开头的单词时,我希望得到所有以字母“ç”或“ç”或“c”或“c”开头的单词)

另一个代码:

preg_match("/".$pattern."/i", remove_accents($word))) || ($common[$word] == 1)
foreach($words['hilight'] as $change) {
while (preg_match("~[^\>](".$change.")[^\<]~i", " ".$title." ", $regs)) {
  $title = preg_replace("~".$regs[1]."~i", "<b>".$regs[1]."</b>", $title);
}
while (preg_match("~[^\>](".$change.")[^\<]~i", " ".$fulltxt." ", $regs)) { 
  $fulltxt = preg_replace("~".$regs[1]."~i", "<b>".$regs[1]."</b>", $fulltxt);
}
$url2 = $url;
while (preg_match("~[^\>](".$change.")[^\<]~i", $url2, $regs)) {
  $url2 = preg_replace("~".$regs[1]."~i", "<b>".$regs[1]."</b>", $url2);
}
}
preg_match(“/”$pattern.“/i”,删除重音($word)))|($common[$word]==1)
foreach($words['hilight']作为$change){

而(preg_match(“~[^\>]”(“$change”)[^\](“$change”)[^\](“$change”)[^\使用php的str_replace函数可能是解决问题的另一种选择

        $string="Put here string containing latin 5 characters";
        $changethis = array("I","ı","İ","ö","Ö","ü","Ü","ç","Ç","ş","Ş","ğ","Ğ"," ","\'","#","$","%","^","&","*","?");
        $tothis = array( "i","i","_i","o","_o","u","_u","c","_c","s","_s","g","_g","","","","","","","","","");
        $newstring = str_replace($changethis, $tothis, "$string");

使用php的stru\u replace函数可能是解决问题的另一种选择

        $string="Put here string containing latin 5 characters";
        $changethis = array("I","ı","İ","ö","Ö","ü","Ü","ç","Ç","ş","Ş","ğ","Ğ"," ","\'","#","$","%","^","&","*","?");
        $tothis = array( "i","i","_i","o","_o","u","_u","c","_c","s","_s","g","_g","","","","","","","","","");
        $newstring = str_replace($changethis, $tothis, "$string");

谢谢你的回答。正如我从代码中看到的,“ç”替换为“c”对吗?在这种情况下,我能找到所有以“甓甓c”和“c”开头的单词吗?或者我只能找到一个以字母“c”开头的单词?第二个问题:“c”是什么“是什么意思?嗨,抱歉迟到了。它会替换字符串中的所有土耳其字符。例如:çto c或çtoçu cthanks作为答复。从代码中可以看出,“ç”替换为“c”对吗?如果是这样,我能找到所有以“甓甓c”和“c”开头的单词吗?或者我只能找到以字母“c”开头的单词吗?”?第二个问题:“_c”是什么意思?嗨,很抱歉迟到了。它替换了字符串中的所有土耳其字符。例如:çto c或çto_c