I would like to check if a string contains any word other than some predefined ones. The predefined words are What is,plus,minus,multiplied by,divided by
, single whitespace included in some of the phrases. I've read this post and this one, both using negative lookaheads, but couldn't come up with a pattern that worked.
For example, input text "What is plus abc divided by" should come back as "abc" not recognized.
What would be a correct regex for this?
Edit:
Note that I don't care about what the invalid token is, just that it exists. It can be anything, a word or a number. The question can also be thought as "check if the input contains only allowed words".