fork download
  1. <?php
  2. $regex = '~<[^>]*>(*SKIP)(*F)|"([^"]*)"~';
  3. $subject = 'Something "with" quotes <a href="page.html">Something "with" quotes</a>';
  4. $replaced = preg_replace($regex,"“$1”",$subject);
  5. echo $replaced."<br />\n";
  6. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Something “with” quotes <a href="page.html">Something “with” quotes</a><br />