$searchthis="php";
$description="<a href=\"http://www.php.net\">php website 8ffhfyphpklmtiu</a> nog meer tekst 8ffhfyphpklmtiu";
$description = str_replace('\"', '"', preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . $searchthis . ")\b#i', '<span style=\"background-color: #FFFF00\">\\\\1</span>', '\\0')",$description));
print $description;
This puts a span style over $searchthis when it is not an atribute of a tag but is in between a tag, wich is OK.
It does not set a span style over regular text. I want it to put a span style over every occurence of $searchthis except if it is an attribute of a tag.
I know it has something to do with the Pattern Modifiers but don't understand it all to wel...