The question is what will be a regular expression to search for a sequence of words, excluding some words in a particular part of a string?
For example, to search for:
word1 * (word2 -word3 -word4) * word5
(where * means any number of any words, and -word means the word exception)
The corresponding lines will be:
word1 word99 word2 word98 word97 word5
word1 word2 word5
Does not match:
word1 word99 word2 word98 WORD4 word97 word5
word1 WORD3 word2 word5
PS It is designed to search in MySQL using the REGEXP operator.
source share