3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "Hello {replace this curley} {{but not this one}} {{{and not this one}}}"; $formatted = preg_replace('/^(?!\{{2,})(?:[^\{]*)(\{{1})(?:[^\{\}]*)(\}{1})$/',"",$string); var_dump($formatted);
based on qscqq
Output for 5.5.0 - 7.3.0rc4
string(71) "Hello {replace this curley} {{but not this one}} {{{and not this one}}}"