The MySQL manual does not describe in detail what expressions it supports, so I'm not sure if MySQL is even possible.
I am trying to create a query with RLIKE that matches the following.
The task is to get all sentences from SQL containing at least any two words from the given sentence from SQL.
Let's say I have some specific words to use in a regular expression:
hello, dog
I have the following suggestions in the database:
hello from dog
hello hello cat
dog says hello
dog dog goes away
big bad dog
Of all that I want to match only
hello from dog
dog says hello
Now it looks like this for me:
SELECT *
FROM test
WHERE
test RLIKE '(hello|dog).*(hello|dog)'
The problem is that I also get unnecessary
hello hello cat
dog dog goes away
So, I think I need a backlink right before the second (hello | dog).
In pseudo code, it will look like this:
RLIKE '(hello OR dog) anything can be here (hello OR dog, but not the word which already was in the previous group)'
so that it looks like this:
'(hello|dog).*(negative backreference to the 1st group goes here)(hello|dog)'
MySQL regex?
, , , , , ++, ?