我有这段文字:
$var = 'bundle:a AND id:9 _query_:" bundle:b AND _query_:"bundle:c AND _query_:"bundle:d" " "';
并希望得到以下输出:
bundle:a AND id:9 _query_:" bundle:b AND _query_:\"bundle:c AND _query_:\"bundle:d\" \""
编辑 1:
我试过:
preg_replace('/(?<!_:|_: )"(?=[^"]*?"(( [^:])|([,}])))/', '\\"', $var )
谢谢 =)