aabaacassabaa
New Member
My code is\[code\]$words = array();$links = array();$result = mysql_query("SELECT `keyword`, `link` FROM `articles` where `link`!='".$act."' ") or die(mysql_error());$i = 0;while($row = mysql_fetch_array( $result )) {if (!empty($row['keyword'])){$words[$i] = '/(?<!(src="http://stackoverflow.com/questions/15753137/|alt="))'.$row['keyword'].'/i';$links[$i] = '<a href="'.$row['link'].'.html" class="ared">'.$row['keyword'].'</a>';$i++;}}$text = preg_replace($words, $links, $text);\[/code\]I want to replace Hello with Guys except img src and alt.From\[code\]Say Hello my dear <img src="http://stackoverflow.com/questions/15753137/say-hello-my-dear.jpg" alt="say hello my dear" />\[/code\]I want\[code\]Say Guys my dear <img src="http://stackoverflow.com/questions/15753137/say-hello-my-dear.jpg" alt="say hello my dear" />\[/code\]The current code, replaces only when my keyword has only 1 word.