For the record, the regex that I actually used, "\\b(?!\\w*?BAD)\\w+\\b", works with the input in your first example. This is because "\\w" won't match a comma, so the lookahead can't see past the next delimiter. That won't work with your second example, since the delimiter is a
word character, but the principle is the same: make sure the lookahead doesn't look past the next delimiter, and that the matched text is preceded and followed by a delimiter. Here's a more general approach that will work for your second example:
This regex should work for any data with a single-character delimiter--just insert the real delimiter in place of each 'X' (and the string you want to exclude in place of "BAD"). In particular cases you may be able to use your knowledge of the data to express it more economically, as I did with your first example, but I'm afraid elegant is out of the question.