[eluser]bugboy[/eluser]
yeah
i want to replace $tag with a a link to $title_tag
Code:
$string = preg_replace($patterns, $replacements, $string, 1);
This would the replace the the first instance of that word with a link to a page about that word.
(a really simple example to show what i mean)
Code:
$tag = 'hello';
$title_tag = "hello_page";
$patterns[] = '/'.$tag.'(?![^<]*>)/i';
$replacements[] = '<a href="'/'.$title_tag.'">'.$title_tag.'</a>';
The thing is if there is a link already in the copy that has hello in it the i'd get nested links