<p>I'm working on a search module that searches in text columns that contains html code. The queries are constructed like: WHERE htmlcolumn LIKE '% searchterm %';</p>

<p>Default the modules searches with spaces at both end of the searchterms, with wildcards at the beginning and/or the end of the searchterms these spaces are removed (*searchterm -> LIKE '%searchterm %'; Also i've added the possibility to exclude results with certain words (-searchterm -> NOT LIKE '% searchterm %'). So far so good.</p>

<p>The problem is that words that that are preceded by an html-tag are not found (<code>&lt;br/&gt;</code>searchterm is not found when searching on LIKE '% searchterm.., also words that come after a comma or end with a period etc.). 
What i would like to do is search for words that are not preceded or followed by the characters A-Z and a-z. Every other characters are ok.</p>

<p>Any ideas how i should achieve this? Thanks!</p>

You could use a regular expression:
http://dev.mysql.com/doc/refman/5.0/en/regexp.html