Regular expression, find word in string, but not surrounded by tag

nightcor3

New Member
These code find first occurance $word in $text, and replace it by something:\[code\]<?php $text = preg_replace("/\b($word)\b/i", 'something', $text, 1);?>\[/code\]But i want ignore if this word surrounded by "a" tag, for example, searching should find only second "word" here: \[code\]<a href="http://stackoverflow.com/questions/3545167/something">text text word text</a>. text2 text2 word text2...\[/code\]
 
Back
Top