Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
09-21-2009, 02:57 PM #1
- Join Date
- Sep 2009
- Thanked 0 Times in 0 Posts
preg_replace not sure what the correct expression is
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>';