<?php $str = '"hi (text here) and (other text)" come (again) and "(again)", right?'; echo preg_replace( '~(?:\G(?!^)|"(?=[^"]+"))[^"()]*(?:"(*SKIP)(*FAIL)|\K[()])~', '\\\$0', $str );
You have javascript disabled. You will not be able to edit any code.