title: preg_replace function: How to search a string without considering a section in it?
body: <pre><code>$string='Stack overflow in &lt;font color=&quot;yellow&quot;&gt; &quot;yellow&quot;&lt;/font&gt; font';
  $words='&quot;yellow&quot;'
  $string=preg_replace('/'.$words.'/i', 
                       &quot;&lt;font style=\&quot;background-color:blue;\&quot;&gt;$0&lt;/font&gt;&quot;,
                       $string);
  </code></pre>
  <p>The string &quot;yellow&quot; is a parameter from a different function.
  preg_replace finds the  &quot;yellow&quot; inside the font tag also. How do I avoid the font tag when using preg-replace?</p>
  <h3>Edit - desired output (newlines introduced for ease of reading only)</h3>
  <pre><code>Stack overflow in &lt;font backgroundcolor=&quot;yellow&quot;&gt;
  &lt;font style=&quot;background-color:yellow&quot;&gt;&quot;yellow&quot;&lt;/font&gt;&lt;/font&gt; font
  </code></pre>