I am trying to come up with a regex that would accept any of the values below combined, except when NONE is present. Something similar to an XOR where if NONE is present nothing else would be accepted, and vice-versa.
This is what I have so far...but it doesn't really enforces the mutual exclusivity of NONE:
(NONE)|((FOO|BAR|SPAM)( ?\| ?(FOO|BAR|SPAM))*)
You can use this regex:
It starts by a negative looking ahead for: any number of any char followed by 'NONE'.
If this test fails (NONE found) then the match will be empty. If no 'NONE' is found, it moves on and matches: From start of string any number of any char followed by any of your Words. This part is repeated.