对于PHP中的自定义脚本解析器,我想用多行字符串替换包含双引号和单引号的单词。 但是,只有以外的文字才能被替换。如何替换双引号和单引号以外的单词
Many apples are falling from the trees.
"There's another apple over there!"
'Seedling apples are an example of "extreme heterozygotes".'
例如,我想用'pear'替换'apple',但只是在引号之外。所以在这种情况下,只有'苹果'在'许多苹果从树上掉下来'才会成为攻击目标。
以上将给出以下的输出:
Many pears are falling from the trees.
"There's another apple over there!"
'Seedling apples are an example of "extreme heterozygotes".'
我怎样才能做到这一点?
你可以发布你的PHP脚本解析这样我们可以建议修改。 –