I want to fetch records in which a given keyword is present into the text but not present within any html tag.
Example with the keyword "span":
Hello <span>world</span>
No, the keyword is only present into tags.
Hello <span>world</span>, blah blah span blah blah
Ok, the keyword is present in the text.
This is what I have so far:
SELECT * FROM mytable WHERE `content` LIKE '%span%' AND `content` NOT LIKE '<%span%>';
But it doesn't work.
What is the right way to do this?