hrock
Jan 3rd 2008, 4:19 am
hi,
I use Preg_replace to automatically links some keywords
Here is my code
$texte = preg_replace('`\b((keyword)s?)\b`si','<a href="../keyword.html">$1</a>',$texte);
It workes great but when my keyword is inside an element like <a href="zzz"> </a> it breaks the links.
My questions is how can i do that preg_replace will note replace any keywords inside an element?
And a second question how can i do that preg_replace dosen't match when there is an - directly before my keyword?
I hope that you all understand my english
Thanks for your help
I use Preg_replace to automatically links some keywords
Here is my code
$texte = preg_replace('`\b((keyword)s?)\b`si','<a href="../keyword.html">$1</a>',$texte);
It workes great but when my keyword is inside an element like <a href="zzz"> </a> it breaks the links.
My questions is how can i do that preg_replace will note replace any keywords inside an element?
And a second question how can i do that preg_replace dosen't match when there is an - directly before my keyword?
I hope that you all understand my english
Thanks for your help