I currently have a link replacement function that I wrote up that finds certain keywords and turns said key words into links to related content.
It has been working fairly well so far, except on occasion, a link that it adds in also contains a keyword.
This issue has resulted in my keywords being turned into a mess of hmtl code and unworking links wherever this occurrence happens.
What I plan to do is one final check before the replace to verify if the keyword is within the element .
Is it possible to determine if the content is between those tags? If so, how is it done?
These are the current patterns that I am using to find the keywords.
$pattern = "/\b $kw \b/";
$pattern2 = "/\b $kw. \b/";
$pattern3 = "/\b $kw, \b/";