php preg match for a tag innerhtml only
<p>How to change only innerHTML of a tag if the tag has a url without changing href atrribute value?
I am using </p>

<pre><code>$str=preg_replace('/((((?:http|https|ftp):\/\/)|(www\.))(?:[A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?[^\s\"\']+)/i','&lt;a href="$1" rel="nofollow" target="_blank"&gt;$1&lt;/a&gt;',$str);
</code></pre>

<p>Again I want to highlight the innerhtml of <code>&lt;a&gt;</code> tag with some keywords
for example:<code>$str=www.google.com, google is a search engine.</code>, and the search keyword is <code>google</code>
now the out put should look like in html</p>

<pre><code>&lt;a href='www.google.com' &gt;www.&lt;b&gt;google&lt;/b&gt;.com&lt;/a&gt;, &lt;b&gt;google&lt;/b&gt; is a search engine.

I used code for that is
$keyword='google';//in this example

$keywords = preg_replace('/\s\s+/i', ' ', strip_tags(trim($keyword))); // filter
foreach(array_unique(explode(' ', $keywords)) as $keyword)
{
    $str = str_ireplace($keyword,"&lt;b&gt;".$keyword."&lt;/b&gt;",$str);
}
</code></pre>
