Ersetzen Sie alle Vorkommen innerhalb des Musters

Ich habe eine Zeichenfolge, die so ist

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

Ich möchte, dass es wird

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

Ich denke, das Beispiel ist einfach genug und ich bin nicht sicher, ob ich besser in Worten erklären kann, was ich erreichen möchte.

Ich habe verschiedene Ansätze ausprobiert, aber keiner hat funktioniert.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage