hello!
i find regex kinda confusing so i got stuck with this problem:
i need to insert <b>
tags on certain keywords in a given text. problem is that if the keyword is within the href attribute, it would result to a broken link.
the code goes like this:
$text = preg_replace('/(\b'.$keyword.'\b)/i','<b>\1</b>',$text);
so for cases like
this <a href="keyword.php">keyword</a> here
i end up with:
this <a href="<b>keyword</b>.php"><b>keyword</b></a> here
i tried all sorts of combinations but i still couldn't get the right pattern.
thanks!