3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Hello {replace this curley} {{but not this one}} {{{and not this one}}}"; $formatted = preg_replace('/^(?!\{{2,})(?:[^\{]*)(\{{1})(?:[^\{\}]*)(\}{1})$/',"",$string); var_dump($formatted);

preferences:
66.19 ms | 402 KiB | 5 Q