# I won't not use no double negatives [closed]

The goal is to simplify sentences containing multiple negatives.
Like with multiplying negative numbers, two negative words annihilate each other until at most one is left (doesn't matter which one). While some words disappear without a trace, other leave behind a positive part

The affected words are:

no
not
couldn't    could
wouldn't    would
shouldn't   should
don't       do
doesn't     does
didn't      did
isn't       is
aren't      are
weren't     were


You will notice that I conveniently forgot to include some rules like shan't/shall, won't/will, nothing/something, impossible/possible. Hunting down all the exceptions is a nightmare and would make it yet another string compression challenge.
But if including some additional rules that are not listed, yet are in the spirit of the challenge would make your code shorter (looking at you, Mathematica built-ins), by all means, go for it.

## Examples

### Input

Move along
Nothing to see here
This sentence will stay the same
You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe.

Don't change this sentence.
This one will also not change
So far no inputs were changed

We don't need no education!
No, don't say that!
Wouldn't it be nice if people weren't fighting?

I don't not use no double negatives.
This isn't not the usual way to not express yourself not
We don't not have no time to not don't solve this
I don't not even know if this isn't not making no sense anymore, it wouldn't be so bad if it weren't for not all these not words which not shouldn't be not there in the first place


### Output (either of the elements is valid)

["Move along"]
["Nothing to see here"]
["This sentence will stay the same"]
["You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe."]

["Don't change this sentence."]
["This one will also not change"]
["So far no inputs were changed"]

["We do need education!"]
[", do say that!", "do say that!", "Do say that!"]
["Would it be nice if people were fighting?"]

["I don't use double negatives.", "I do not use double negatives.", "I do use no double negatives."]
["This is the usual way to express yourself"]
["We don't have time to do solve this", "We do not have time to do solve this", "We do have no time to do solve this", "We do have time to not do solve this", "We do have time to don't solve this"]
["I do even know if this is making sense anymore, it would be so bad if it were for all these words which should be there in the first place"]

• – DenDenDo Sep 21 '18 at 19:23
• I'm confused as to when to remove the whole word (as in your We don't need no education example) or when to replace the word with its complement (as in your Wouldn't it be nice example). – AdmBorkBork Sep 21 '18 at 19:48
• Are we really supposed (or at least allowed) to replace won't with wo as one of the examples suggest? If the rule is just remove n't, then this is inconsistent with can't: according to the table, it must be replaced with can rather than ca. – Arnauld Sep 22 '18 at 8:37
• I'm temporarily voting to close as unclear. Please ping me when it's clarified so that I can retract my vote or vote to reopen. – Arnauld Sep 22 '18 at 8:38
• I removed can't and won't from the requirements and tests and allow undefined behaviour in those cases instead of overcomplicating it – DenDenDo Sep 22 '18 at 14:32

i(\bnot?\W+|n't\b)(.*?)(\bnot?\W+|n't\b)

• It is apparently allowed to replace won't with wo (!), but the table suggests that can't should be replaced with can rather than ca`. (I think this needs to be clarified in the challenge, anyway.) – Arnauld Sep 22 '18 at 8:09