Hi all,
I want to replace strings matching the pattern
{#<whatever>} (where whatever may vary) with the corresponding replacement, but only in unquoted strings. I know how to do this in all strings, but not in only unquoted ones.
for example:
PHP Code:
$string = "The \"quick {#colour}\" {#animal} jumps over the '{#adjective} dog'";
I know how to get preg_replace to replace {#colour}, {#animal} and {#adjective} with replacement strings, BUT what (generic) pattern should I use to make preg_replace ignore {#colour} and {#adjective} and only replace {#animal}?
I.e. I want to ignore matching patterns in strings-within-the-string.
Any help much appreciated