...

View Full Version : preg_replace not sure what the correct expression is



twelve20
09-21-2009, 01:57 PM
Hi all

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

PHP Code:




$patterns[] = '/'.$tag.'(?![^<]*>)/i';
$replacements[] = '<a href="'/'.$tag.'">'.$tag.'</a>';



Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum