The question is, what will be regular expression for search of words sequence excluding some words in concrete part of string?
For example, for search request:
word1 * (word2 -word3 -word4) * word5
(where * means any number of any words, and -word means excluding word)
Matched strings will be:
word1 word99 word2 word98 word97 word5
word1 word2 word5
Not matched:
word1 word99 word2 word98 WORD4 word97 word5
word1 WORD3 word2 word5
P.S. It’s for search in MySQL using REGEXP operator.
You will not be able to do that with REGEXP, you should create a FULLTEXT index on your column and do FULLTEXT searches, doing the searches IN BOOLEAN MODE will give you all the features you want.