I need to scan a block of body copy that will replace certain words within the copy with other words.
I can do this is and got this part working.
How ever i need it to replace only words out side of any html tags. <.*> </.*> < />
So if the word appears in a link its ignored.
Any ideas on how to do this?
my code so far
$patterns = '/'.$tag.'(?![^<]*>)/i';
$replacements = '<a href="'/'.$tag.'" >'.$tag.'</a>';