I have the following JSON encoded line:
$json = '"|\t|\n|\\\u0027|\\\u0022|"';
What is the most efficient way to avoid all (already) escaped characters / code points except \\\u0022or \\\u0027? . Although I used preg_replace()with a negative regex, but it does not work as I expected, the output should be:
$json = '"|\\\t|\\\n|\\\u0027|\\\u0022|"';
I feel lost in this ocean of survival JSON-PHP-PCRE, can someone help me?
source
share