斯洛伐克语中有两个非常相似的表达式存在问题。我试图替换html链接的表达式,下面是我的示例代码。我在阵列中有大约90个字。preg_replace与两个相似的单词
// mysql query above.
for($i=1;$i<=$datas[1];$i++) {
$regex[] = '/('.htmlentities($rows['title'], ENT_QUOTES, 'UTF-8').')/i';
$wrl[] = '<a href="'.URL.'link/'.urlencode($rows['alias']).'" class="underscored">'.strtolower($rows['title']).'</a>';
}
$content = preg_replace($regex, $wrl, $content);
但我有一个非常相似的单词的问题; (nenasytene mastne kyseliny,nasytene mastne kyseliny)。 preg_replace从较长的单词中删除ne,这会导致单词链接到错误的文章。
非常感谢。它完美无瑕。 – InsaneSVK