Okay so let me be clear about this, I have a user interface where a user can search for products based on their product title, and the way it's built is that you don't need to type the full exact title to get a match. Basically under the hood it uses '$regex' operator on the find method, so if I type /banana/ it retrieves any product that contains on the title the word banana.
The good part of this is that if I type: /^((?!banana).)*$/
It negates it, and returns any product that doesn't contain the word banana.
What I am trying to achieve is giving the negation feature to the user on a more friendly way instead of using the whole regex above.
So I thought about telling the user to use exclamation mark on the start of text and then under the hood replace it by this regex wrapper /^((?!banana).)*$/ . The problem is that I will lose functionality if there is any valid regex that starts by exclamation mark, because I will always be replacing the search tag with the negation wrapper. Does it make sense?
Thank you