Whereclause to get result with the required word inside the message?

I want to get result for message = “this bug is my” but not for “bugler is good”
I tried several way without success:

  1. whereClause = “message REGEXP ‘[[:<:]](query)[[:>:]]’”
    it will produce 1017 error
  2. whereClause = “message LIKE ‘%(query)[!a-z]%’”
    silently did not work
  3. whereClause = “message LIKE ‘%(query)[!a-z]%’”
    silently did not work
  4. whereClause = “message LIKE ‘%(query)[ ]%’ OR message LIKE ‘%(query)’”
    silently did not work

Could you help me with this?

Hi Maxim,

In order to find something containing “this bug is my” you need to use the following where clause:

message LIKE '%this bug is my%'

And to exclude everything containing “bugler is good” the following one should be used:

message NOT LIKE '%bugler is good%'

If you need, you can combine these two queries with AND:

message LIKE '%this bug is my%' AND message NOT LIKE '%bugler is good%'

Please provide more details in case I didn’t understand your question correctly.

Thank you for your response. ok. It looks like I was not so clear. I would like to find any message which contains the word ‘bug’ - and I give the examples. Of course I do not want to find exact example.

Well, you could try to search for ’ bug ', but of course this won’t handle the cases where there are any other symbols than whitespaces. If you need to handle those cases, you’ll need to enumerate them all with AND.

message LIKE '% bug %'