I have a list of dictionary words which I load into an array. I grab a block of text from a database table text field. I loop through the dictionary words, and on each iteration, I check the block of text for occurrences of the word. Whenever a match is found, I replace that word in the block with a hyperlinked version, so when the block of text is published I can hover over it with the mouse pointer and popup a definition. This is simple to achieve with a regular expression:\[code\]$text = preg_replace("/($dictionary_word)/i", '<a href="" class="glossary_term">$1</a>', $text, -1, $count); \[/code\]If I run the "dictionary word linker" more than once though, the links will be doubled up.What I need to do is code regular expression that detects an open anchor tag that has not been closed by the time a dictionary word is reached. That way I will know that the word is already linked, so I skip over it.I tried various combinations of look ahead and look behind, with no success.