I've written this code to link all hashtags in my blog posts:
function HashTags($string){
global $post_userid;
return preg_replace(
'/\s*#([a-zA-Z0-9\-_]+)/i',
" <a href=\"blog.php?id=".$post_userid."&search=$1\">#$1</a>",
$string
);
}
And it works awesome! but the problem is, that if there is some CSS code inside the same string, this function transform that css too..
Ex:
<div style="color: #fff">Hello world</div>
My question is: Is it possible to ignore that css with my regex function to avoid turning that #fff into a link too...