I want to filter columns that match a specific word or sentence. For instance, if I chose the word anti for filtering, among the following rows:
this is anti-pattern
antimosquitos products
the word anti is cool
I just want to keep the last one, since it's the only one that matches the entire matching pattern as a whole, and not within another word.
I have tried using RLIKE and I always get a FALSE value but I don't understand why. I expected to have a TRUE value at least in one of these SQL statements:
SELECT RLIKE ('Spray antimosquitos', '\bantimosquitos\b', 'i') as p1;
SELECT RLIKE ('Spray antimosquitos', '\santimosquitos\s', 'i') as p1;
SELECT RLIKE ('Spray antimosquitos', '\santimosquitos', 'i') as p1;
SELECT RLIKE ('Spray antimosquitos', '\santimosquitos', 'i') as p1;
However, this is not the case. I have tried with other forms like:
SELECT RLIKE ('Spray antimosquitos', '\b antimosquitos \b', 'i') as p1
SELECT RLIKE ('Spray antimosquitos', '*antimosquitos*', 'i') as p1
SELECT RLIKE ('Spray antimosquitos', ' antimosquitos ', 'i') as p1
And I don't manage to have a returned value TRUE.
What is wrong with my RLIKE?