title: regex to higlight the word part-by-part if it contain the keyword
body: <p>i've asked same question before <a href="https://stackoverflow.com/questions/2483844/highlight-the-word-in-the-string-if-it-contains-the-keyword">here</a>, but now i need to higlight the keywortd in another way, then other part of word. example will be helpful i think</p>
  
  <pre><code>$str = "i like programming very much";
  $key = "gram"; 
  </code></pre>
  
  <p>i need to get something like <em>pro</em> <strong>gram</strong> <em>ming</em></p>
  
  <pre><code>$str = "i like &lt;span class='first'&gt;pro&lt;/span&gt;&lt;span class='second'&gt;gram&lt;/span&gt;&lt;span class='firs'&gt;ing&lt;/span&gt;"
  
  why preg_replace("/([^\s]*?)(".preg_quote($key).")([^\s]*)/iu","&lt;span class="first"&gt;$0&lt;/span&gt;&lt;span class="second"&gt;$1&lt;/span&gt;&lt;span class="first"&gt;$2&lt;/span&gt;",$str);
  doesn't work?
  </code></pre>
  
  <p>Thanks</p>