I have a ordinary bbCode function that search for for example [b] and [/b] in my posts and replace these with for example bold text. When a visitor search some a post on my blog, it can happen that he or she search after something that is a filename for a image ([img]path/to/image.jpg[/img]). If this happens, the image will be gone from the post due to the highlighting.
How can I make the search engine (which is a regular WHERE column LIKE '%string%') to not search within my bbCodes?
Thanks in advance.
You could add another clause to exclude certain tags:
Note that doing so will exclude all results with an [img] tag inside, even if there are other tags you may want to consider. Since this is probably not what you really want, you should leave your query as it is and do the replacement with a regular expression in PHP.