Substitua todas as ocorrências dentro do padrão

Eu tenho uma string que é assim

<code>{{ some text @ other text @ and some other text }} @ this should not be replaced {{ but this should: @ }}
</code>

Eu quero que isso se torne

<code>{{ some text ### other text ### and some other text }} @ this should not be replaced {{ but this should: ### }}
</code>

Eu acho que o exemplo é direto o suficiente e eu não tenho certeza se posso explicar melhor o que eu quero alcançar em palavras.

Eu tentei várias abordagens diferentes, mas nenhuma funcionou.

questionAnswers(3)

yourAnswerToTheQuestion