This code:
<?php
$string = "\"single quote";
preg_match_all("/\"/im", $string, $m);
$all_quotes = count($m);
preg_match_all("/\\\"/im", $string, $m);
$escaped_quotes = count($m);
echo "<pre>";
echo "<b>string:</b> $string<br>";
echo "<b>all quotes:</b> $all_quotes<br>";
echo "<b>escaped quotes:</b> $escaped_quotes<br>";
echo "</pre>";
?>
Is supposed to match all quotes, then match all escapes quotes, and echo the results.
For some reason, for string "single quote
it echoes both one quote and one escaped quote, however the pattern /\\\"/im
matches nothing when executed in http://regexr.com with same string.