PHPのカスタムスクリプトパーサーの場合、二重引用符と一重引用符を含む複数行の文字列内のいくつかの単語を置き換えたいと思います。ただし、引用符の外側にあるテキストのみを置き換えることができます。
Many apples are falling from the trees.
"There's another apple over there!"
'Seedling apples are an example of "extreme heterozygotes".'
たとえば、「apple」を「pear」に置き換えたいのですが、引用文の外側に限られます。したがって、この場合、「多くのリンゴが木から落ちている」内の「リンゴ」のみが対象になります。
上記の場合、次の出力が得られます。
Many pears are falling from the trees.
"There's another apple over there!"
'Seedling apples are an example of "extreme heterozygotes".'
どうすればこれを達成できますか?